Support the ongoing development of Laravel.io →
Authentication Security Session
Last updated 1 year 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 1 year ago.
0
Solution

Thanks for the reply. I managed to do it.

Route::group(array('before' => 'auth'), function(){
	Route::resource('admin/menu', 'admin\MenuController');
});
Last updated 1 year 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', 'UserController@getDashboard') and your original filter in the constructor should then work.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

shiva shiva Joined 24 Jul 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.