我正在尝试使用laravel路线编曲,但我希望它没有名字。我的意思是,而不是做/ user / {id}或/ user / {id} / show,我只想拥有它是/ {id}和/ {id} / show就是这样。
还有一个内部如此状态,即
/ {id} / status / {id} / show
答案 0 :(得分:2)
更新:尝试
Route::resource('/', 'UserController');
Route::resource('/.status', 'UserStatusController');
它会给你
+----------------------------------+----------------+------------------------------+ | URI | Name | Action | +----------------------------------+----------------+------------------------------+ | GET|HEAD / | index | UserController@index | | GET|HEAD create | create | UserController@create | | POST / | store | UserController@store | | GET|HEAD {} | show | UserController@show | | GET|HEAD {}/edit | edit | UserController@edit | | PUT {} | update | UserController@update | | PATCH {} | | UserController@update | | DELETE {} | destroy | UserController@destroy | | GET|HEAD {}/status | status.index | UserStatusController@index | | GET|HEAD {}/status/create | status.create | UserStatusController@create | | POST {}/status | status.store | UserStatusController@store | | GET|HEAD {}/status/{status} | status.show | UserStatusController@show | | GET|HEAD {}/status/{status}/edit | status.edit | UserStatusController@edit | | PUT {}/status/{status} | status.update | UserStatusController@update | | PATCH {}/status/{status} | | UserStatusController@update | | DELETE {}/status/{status} | status.destroy | UserStatusController@destroy | +----------------------------------+----------------+------------------------------+
在UserStatusController
class UserStatusController extends BaseController
{
public function edit($user_id, $status_id)
{
//
}
}