注册路由访问页面

打开路由注册文件/routes/web.php添加代码

createRessorceRoute('test','TestController');
//后台路由
Route::group(['prefix'=>'admin','namespace'=>'Admin','middleware'=>['auth','admin']],function(){
    Route::get('index', 'IndexController@index'); //后台主页
    createRessorceRoute('area','AreaController');
    createRessorceRoute('user','UserController');
    createRessorceRoute('role','RoleController');
    createRessorceRoute('log','LogController',['except'=>['edit','import']]);
    createRessorceRoute('menu','MenuController');
    createRessorceRoute('config','ConfigController');
    createRessorceRoute('admin','AdminController');
    createRessorceRoute('notification','NotificationController',['only'=>['index','list','show','destroy']]);
    Route::get('tolead/index', 'ToleadController@index');
    Route::get('personage/password', 'PersonageController@password'); //密码修改
    Route::get('personage/index', 'PersonageController@index'); //个人资料

    //在此添加新建路由
    createRessorceRoute('test','TestController');
});

最后打开/database/seeds/MenuTableSeeder.php将路由填写到菜单数据表,这里我们将路由放到ID为6的"其它设置"菜单目录下

      //ID:70
        $menu = factory(\App\Models\Menu::class)->create([
            'name'=>'测试',
            'icons'=>'fa-map-pin',
            'url'=>'/admin/test/index',
            'description' => '测试',
            'parent_id'=>6,
            'is_page'=>1,
            'status'=>1
        ]);

        //ID:71-76
        $this->createRessorceMenu($menu,'测试');

执行填充脚本

php artisan db:seed --class=MenuTableSeeder

这样你就可以直接访问页面/admin/test/index了

powered by GitbookFile Modify: 2017-09-26 17:37:30

results matching ""

    No results matching ""

    results matching ""

      No results matching ""