Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message Laravel 5.5

前端 未结 4 1425
再見小時候
再見小時候 2021-01-12 03:08

This is doing my head in. I\'m getting this error when trying to login from a form:

Symfony \\ Component \\ HttpKernel \\ Exception \\

Me

相关标签:
4条回答
  • 2021-01-12 03:41

    Error in the route you've defined. Its get and should change to post

    change this

    Route::get('/login', ['as' => 'login', 'uses' => 'LoginController@getLogin']);
    

    to this

    Route::post('/login', ['as' => 'login', 'uses' => 'LoginController@getLogin']);
    

    action="{{ route('login') }}" # form Submit action
    
    0 讨论(0)
  • 2021-01-12 03:42

    your answer of the route should be

    Route::post('/login', ['as' => 'login', 'uses' => 'LoginController@getLogin']);
    
    0 讨论(0)
  • 2021-01-12 03:52

    This problem appears only if you forget attached method on your form or error in Route method.

    So be sure you added method POST/GET in your form. And don't forget make matching route.

    <form method="POST">
    

    If your form method is post. make post route like this.

    Route::post();
    

    I hope you understand the method define. If you're facing problem, comment below.

    0 讨论(0)
  • 2021-01-12 03:55
    Route::post('/', 'PostController@index');
    
    Route::post('/posts/create', 'PostController@create');
    
    Route::post('/posts', 'PostController@store');
    

    Post or get..if u pass post value than use post.

    0 讨论(0)
提交回复
热议问题