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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -