The following is an example from the documentation:
Route::group(['namespace' => 'Admin'], function(){
// 控制器在 "App\Http\Controllers\Admin" 命名空间下
Route::group(['namespace' => 'User'], function()
{
// 控制器在 "App\Http\Controllers\Admin\User" 命名空间下
});
});
Assume that there is an ArticleController under both the Admin and User namespaces. To access these two different controllers, how should the URL be written?
我想大声告诉你2017-05-16 16:56:18
Route::controller('/XX/api/' , "Admin\User\XXController");
Route::controller('/XX/api/' , "Admin\User");
Just follow the form Admin
改为AdminUser
即可
如果User是一个目录的话,写成AdminUserXXController
as shown above
For example:
Route::group(['namespace' => 'Admin'], function(){
// 控制器在 "App\Http\Controllers\Admin" 命名空间下
Route::group(['namespace' => 'Amind\User'], function()
{
// 控制器在 "App\Http\Controllers\Admin\User" 命名空间下
});
});