Reputation: 1398
in my codes all get requests is working properly but not same for post methods.
This is work
Route::group(['middleware' => 'oauth'], function ()
{
Route::get('/info', 'UserController@info');
});
This is not work
Route::group(['middleware' => 'oauth'], function ()
{
Route::post('/info', 'UserController@info');
});
What can be wrong ?
Upvotes: 1
Views: 169
Reputation: 32354
You are using in both routes the same controller function, you need a function for each request
Route::group(['middleware' => 'oauth'], function ()
{
Route::get('/info', 'UserController@info');
Route::post('/info', 'UserController@setInfo');
});
post request don't return view, only alter data and do redirects
Upvotes: 0
Reputation: 393
If you are using blade in front-end, you can use {{crf_field()}}
after opening the post form
Upvotes: 1
Reputation: 27325
Your codes looks ok but that happen sometimes if the csrf token is missing in the form. You should check that.
https://laravel.com/docs/5.2/routing#csrf-protection
Upvotes: 0