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
Post a Comment