I recently started developing with Laravel 4, and I had a question about routes.
For '/', I would like to have two different browse pages based on the state of the auth user.
If the user is logged in and is viewing "/", I would like to show them a view with administrator controls, and when the user is viewing "/" as a regular user without logging in, I would like to offer a general view of the information.
To achieve this, I played with the filters "auth" and "guest", but I had no luck. //app/routes.php
// route for logged in users Route::get('/', array('before' => 'auth', function() { return 'logged in!'; })); // for normal users without auth Route::get('/', function() { return 'not logged in!'; }));
The above code works with the point where, as a registered user, I can display the correct answer, but after logging out I do not see the correct answer as a regular user.
Perhaps this is what needs to be processed in the controller? If someone could point me in the right direction, that would be very helpful.
source share