Thursday, August 13, 2015

Short and easy way to write a route path in Laravel 5.1

Short & Easy way to define route in Laravel:

In Laravel 4.2, Genrallay we define any route like this:



Route::post('/sign-in', 'UserController@signIn');
                              
                           OR

Route::get('/sign-in', 'UserController@signIn');

In Laravel 5.1 we can write route like this & also can write a different method.


We don't need to write 'Route::' for define any route. We can simply write it down as

post('/sign-in', 'UserController@signIn');
                              
                           OR

get('/sign-in', 'UserController@signIn');

 Thanks

No comments:

Post a Comment