我有这些路线:
Route::group(['middleware' => ['role:admin'], 'prefix' => 'admin'], function()
{
Route::resource(__('route.events'), 'Auth\RoleAdmin\EventController');
});
Route::group(['middleware' => ['role:user'], 'prefix' => 'user'], function()
{
Route::resource(__('route.events'), 'Auth\RoleUser\EventController');
});
我希望资源路由的名称分别以admin.
和开头user.
,但它不会发生。
这是命令的结果php artisan route:list
:
| | GET|HEAD | auth/admin/events | events.index | App\Http\Controllers\Auth\RoleAdmin\EventController@index | web,auth,role
:admin,guest,role:admin|user |
| | POST | auth/admin/events | events.store | App\Http\Controllers\Auth\RoleAdmin\EventController@store | web,auth,role
:admin,guest,role:admin|user |
| | GET|HEAD | auth/admin/events/create | events.create | App\Http\Controllers\Auth\RoleAdmin\EventController@create | web,auth,role
:admin,guest,role:admin|user |
| | DELETE | auth/admin/events/{events} | events.destroy | App\Http\Controllers\Auth\RoleAdmin\EventController@destroy | web,auth,role
:admin,guest,role:admin|user |
| | GET|HEAD | auth/admin/events/{events} | events.show | App\Http\Controllers\Auth\RoleAdmin\EventController@show | web,auth,role
:admin,guest,role:admin|user |
| | PUT|PATCH | auth/admin/events/{events} | events.update | App\Http\Controllers\Auth\RoleAdmin\EventController@update | web,auth,role
:admin,guest,role:admin|user |
| | GET|HEAD | auth/admin/events/{events}/edit | events.edit | App\Http\Controllers\Auth\RoleAdmin\EventController@edit | web,auth,role
:admin,guest,role:admin|user |
如您所见,管理员的路由和用户的路由具有相同的名称,并且名称不包含前缀。