I am trying to create a filter in Laravel so that only admins are allowed to access some URLs.
What I have done is,
Route::filter('admin', function()
{
if (Auth::user()->permission != -1)
{
if (Request::ajax())
{
return Response::make('Unauthorized', 401);
}
else
{
return Redirect::guest('/');
}
}
});
in the app/filters.php file.
But I am getting an eror like this if I try yo access admin's url-
Users table is like this-
Can anyone help please?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire