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 -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -