How to route GET and POST for same pattern in Laravel? How to route GET and POST for same pattern in Laravel? laravel laravel

How to route GET and POST for same pattern in Laravel?


The docs say...

Route::match(array('GET', 'POST'), '/', function(){    return 'Hello World';});

source: http://laravel.com/docs/routing


See the below code.

Route::match(array('GET','POST'),'login', 'AuthController@login');


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.