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

Popular posts from this blog

javascript - IndexedDB error: Uncaught DataCloneError: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned -

amazon web services - When using Cognito credentials with AWS in a browser (javascript), keep getting "missing credentials" error -

c# - How to set the datatextfield value instead of the value on a drop down list? -