在我的应用程序中,我有事件的概念。每个活动都可以由用户预订,如果该用户需要取消,也可以取消预订。
我的活动路线如下:
Route::get('events/search', 'EventsController@search');
Route::get('events/past', 'EventsController@past');
Route::get('events/{id}/invite', [
'as' => 'invite', 'uses' => 'EventsController@invite'
]);
Route::get('events/{id}/invite/groups', [
'as' => 'inviteGroups', 'uses' => 'EventsController@inviteGroups'
]);
Route::get('events/{id}/duplicate', [
'as' => 'duplicate', 'uses' => 'EventsController@duplicate'
]);
Route::get('events/{id}/book', [
'as' => 'book', 'uses' => 'EventsController@book'
]);
Route::get('events/{id}/unbook', [
'as' => 'unbook', 'uses' => 'EventsController@unbook'
]);
Route::post('events/{id}/groups', [
'as' => 'addGroups', 'uses' => 'EventsController@addGroups'
]);
Route::post('events/{id}/helpers', [
'as' => 'addHelpers', 'uses' => 'EventsController@addHelpers'
]);
Route::resource('events', 'EventsController');
我对“book”路线有困难,当我点击它时会抛出以下错误:
MethodNotAllowedHttpException in RouteCollection.php line 201:
该路由使用一个将用户附加到事件的函数,然后将该用户返回到事件页面。
我确定它是一个优先顺序问题,但无论我如何组织路线,我都会遇到这个错误。这是列表中唯一导致问题的路径。是否有关于路线组织的最佳实践来解决此问题?