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? ?
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.