Closed agenciati closed 10 years ago
The same way you would do with a normal route. Except you'll not want to use the default auth filter, as it won't work.
This is the original route filter as defined in app/filters.php.
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::guest('login');
});
But for it to work with something like admin, you'd want to delete these filter and replace it with something like this.
Route::filter('auth.admin', function()
{
if (Auth::admin()->guest()) return Redirect::guest('login');
});
Obviously you can recreate this filter as many times as you want, for each user type.
For more on filters, see the Laravel documentation: http://laravel.com/docs/routing#route-filters
Hi,
How do i create a protected route with this?
i currently use the following route... i intend to have one for the admin dashboard and one for the client.
Route::group(array('before' => 'auth'), function() { Route::get('dashboard', 'BoardController@getDBoard'); ... });