<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::prefix('admin')->group(function() {
    //后台首页
    Route::get('/', 'AdminController@index')->middleware('auth');
    //后台登录
    Route::get('/login', 'LoginController@loginView');
    Route::post('/login', 'LoginController@doLogin');
    //退出登录
    Route::get('/logout', 'LoginController@logout');
    //后台首页
    Route::get('/welcome', 'AdminController@welcomeView');

    //菜单管理
    Route::get('/menus/list', 'MenusController@index');
    Route::get('/menus/add', 'MenusController@add');
    Route::post('/menus/add', 'MenusController@addPost');
    Route::get('/menus/edit', 'MenusController@edit');
    Route::post('/menus/edit', 'MenusController@editPost');
    Route::post('/menus/del', 'MenusController@delPost');

    //用户管理
    Route::get('/users', 'UsersController@index');
    Route::get('/users/list', 'UsersController@userList');
    Route::get('/users/list/view', 'UsersController@userDetail');
    Route::get('/users/list/add', 'UsersController@add');
    Route::post('/users/list/add', 'UsersController@addPost');
    Route::get('/users/list/edit', 'UsersController@edit');
    Route::post('/users/list/edit', 'UsersController@editPost');
    Route::post('/users/list/del', 'UsersController@delPost');
    Route::get('/users/list/resetpassword', 'UsersController@resetPassword');
//    Route::get('/users/roles/change', 'UsersController@rolesChange');
    Route::match(['get', 'post'], '/users/roles/edit', 'UsersController@roles');
});

//菜单导出文件
Route::get('/file/menu', 'MenusController@makeMenuToFile');
