php - Laravel show page according to authentication status -
is there way can configuration in routes.php:
route::get('/', function(){ if ( auth::check() === false ) { return homecontroller@guest<--- specific controller's method } else { return homecontroller@logged <--- specific controller's method } }); i don't want use redirect since want keep mysite.com/ main address.
of course can directly in route @ferticidios answer or have 1 controller method @maytham suggests. can asked for:
route::get('/', function(){ if ( auth::check() === false ) { return app::make('homecontroller')->callaction('guest', array()); } else { return app::make('homecontroller')->callaction('logged', array()); } });
Comments
Post a Comment