0
我在Laravel 5.2這樣的路由:Laravel 5動態控制器路由
Route::group([ 'prefix' => 'users/{hash}/addresses', 'as' => 'admin.addresses.' ], function() {
Route::get('getdata', [ 'as' => 'getdata', 'uses' => '[email protected]' ]);
Route::get('create', [ 'as' => 'create', 'uses' => '[email protected]' ]);
Route::post('create', [ 'as' => 'store', 'uses' => '[email protected]' ]);
});
如何設置我的動作控制器的名字在我的路由組申報?
它的假設是這樣的:
Route::group([ 'prefix' => 'users/{hash}/addresses', 'as' => 'admin.addresses.', 'controller' => 'AddressController' ], function() {
Route::get('getdata', [ 'as' => 'getdata', 'uses' => 'getData' ]);
Route::get('create', [ 'as' => 'create', 'uses' => 'create' ]);
Route::post('create', [ 'as' => 'store', 'uses' => 'store' ]);
});
如何設置資源路由的別名? 「as」=>「admin.addresses.blabla」 – yudijohn
我編輯我的答案。你想添加url路徑作爲資源參數 – IshaS
如果你在組「users/{hash}/addresses」中有這條路由,你只需要添加「admin.addresses」作爲資源參數 – IshaS