laravel - routing permissions issue
伊谢尔伦
伊谢尔伦 2017-05-16 16:48:33
0
1
370
Route::group(['middleware' => 'privilege_auth:' . Privilege::Agent . ',true'], function () {
    Route::get('/agent', function () {
        return View::make('agent/agent')->with(["resource_host"=>env("STATIC_RESOURCE_HOST")]);
    });
    Route::get('/admin/{theme}/page', 'AdminController@getEditPage');
});

Route::group(['middleware' => 'privilege_auth:' . Privilege::Agent . ',true'], function () {
    Route::get('/agent', function () {
        return View::make('agent/agent')->with(["resource_host"=>env("STATIC_RESOURCE_HOST")]);
    });
    Route::get('/admin/{theme}/page', 'AgentController@getEditPage');
});

The Agentservice corresponding to AgentController inherits from the Adminservice corresponding to AdminController, and some permissions are restricted in AgentService. However, I later discovered that after writing the route like this, if I log in with an account with admin permissions, it will eventually become agent permissions. Is there any solution? ?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
左手右手慢动作

These two routing groups cannot be used together because the routing rules are the same. Laravel will use the second routing to overwrite the first one, so no matter how they are used, the second group is valid. If they must be used together, The routing prefix prefix should be added to the group to distinguish it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template