当我尝试访问delayTime方法时出现此错误。我看不出自己做错了什么。我的路线设置如下:
Route::post('quiz', [ 'as' => 'quiz', 'uses' => 'QuizController@create' ]);
Route::get('quiz/token/{quizByToken}', [ 'as' => 'quiz.token', 'uses' => 'QuizController@getQuizByToken' ]);
Route::get('quiz/code/{quizByCode}', [ 'as' => 'quiz.code', 'uses' => 'QuizController@getQuizByCode' ]);
Route::get('quiz/id/{quiz}/players', [ 'as' => 'quiz.players', 'uses' => 'QuizController@getQuizPlayers' ]);
Route::get('quiz/token/{quizByToken}/players/highscore', [ 'as' => 'quizzes.player.highscore', 'uses' => 'PlayerController@highscore' ]);
Route::put('quiz/nextQuestion/{quizByToken}', [ 'as' => 'quizzes.nextQuestion', 'uses' => 'QuizController@nextQuestion' ]);
Route::get('quiz/poll/{quiz}', [ 'as' => 'quizzes.poll', 'uses' => 'QuizController@currentQuestion' ]);
Route::put('quiz/poll/token/{quizByToken}/delay-current/{delayTime}', [ 'as' => 'quizzes.delayTime', 'uses' => 'QuizController@delayTime' ]);
错误讯息:
NotFoundHttpException in RouteCollection.php line 161 in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 750
at Router->findRoute(object(Request)) in Router.php line 659
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
答案 0 :(得分:0)
您使用以下路线:
SourceFunction
这意味着当您提交表单时,您必须在其中传递名为Route::put(
'quiz/poll/token/{quizByToken}/delay-current/{delayTime}',
[ 'as' => 'quizzes.delayTime', 'uses' => 'QuizController@delayTime'
]);
且值为_token
的隐藏输入字段,例如:
put
我确定你错过了它。您可以查看Form Method Spoofing以获取有关此主题的更多信息。