one way could be to use the construct()method in the Controllers used for admin tasks like so:
public function __construct()
{
parent::__construct();
$this->beforeFilter('admin');
}
and then you filter it eg
Route::filter('admin', function()
{
if (Auth::user()->admin != 1) return Redirect::to('/');
});
which, in this case, assumes you have an admin field set up in your users table with a boolean 1 or 0
ooops, just saw you're working on L5. Then you should use middleware: http://mattstauffer.co/blog/laravel-5.0-middleware-filter-style
If you need a little bit more control you can try Laraguard. It's a permission module I wrote to protect controllers and/or methods and quite easy to use.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community