How to route GET and POST for same pattern in Laravel?
Solution 1:
The docs say...
Route::match(array('GET', 'POST'), '/', function()
{
return 'Hello World';
});
source: http://laravel.com/docs/routing
Solution 2:
See the below code.
Route::match(array('GET','POST'),'login', 'AuthController@login');
Solution 3:
You can combine all HTTP verbs for a route using:
Route::any('login', 'AuthController@login');
This will match both GET
and POST
HTTP verbs. And it will also match for PUT
, PATCH
& DELETE
.