laravel - Add a function to a route? -


here's route:

route::get('log-in', array( 'as' => 'log-in', 'uses' => 'authcontroller@getlogin' )); 

what's best way add in test it:

route::get('log-in', function() {     if (auth::check())//do }); 

i know add filter need on route.

you cannot both, have function , controller action in route, see 3 options:

1) add s filter, best one.

2) instantiate controller inside closure (anonymous function) , call action it.

3) auth::check() inside controller or service class called controller.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -