Your filter is actually pretty close, take the auth filter for example:
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::guest('login');
});
Here we see the auth filter checking if the user is a guest or not, and if true, the filter redirects the user to a 'login' page.
We can add filter with similar logic to achieve what you want.
Route::filter('<whatever filter name here>', function()
{
if (Auth::guest())
{
return Redirect::action('PagesController@home');
}else {
return Redirect::action('DashController@index');
}
});
Let me know if this helps.
I had the same issue and solved it using a ternary. In one view I also had to set some variables, which previously had been part of the extend, so I just moved it up.
<?php
$title = 'FAQ';
$active_menu_item = 'FAQ';
?>
@extends(Auth::user() ? 'layouts.app' : 'layouts.main')
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community