Support the ongoing development of Laravel.io →
Authentication Security Session
Last updated 3 months ago.
0

Create a route filter: http://laravel.com/docs/routing#route-filters

In the filter you check if the user is an admin or not.

You can set the filter also in your controller like you did it with csrf and auth.

Last updated 3 months ago.
0

Thanks for the reply. I managed to do it.

Route::group(array('before' => 'auth'), function(){
	Route::resource('admin/menu', 'admin\MenuController');
});
Last updated 3 months ago.
0

just a quick point from your sample code it looks like you are not using the getDashboard method of your user controller.
change your route to use it Route::get('admin/dashboard', '[email protected]') and your original filter in the constructor should then work.

Last updated 3 months ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

shiva shiva shiva Joined 24 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.