Support the ongoing development of Laravel.io →
posted 10 years ago
Requests
Last updated 2 years ago.
0

What does your controller method look like for admin?

Also, you might want to tidy these routes up a bit:

  1. You can set the base root inside of a prefix using /, to go to the prefix URL:
Route::group(array('prefix' => 'admin', 'before' => 'role:administrator'), function()
{
        Route::get('/', 'UserController@index');
	Route::get('user/{user}/destroy', 'UserController@destroy');
	Route::resource('user', 'UserController');
	Route::resource('roles', 'RolesController');	
});
  1. You don't need to put forward slashes before every route name:
Route::get('/game', ['as' => 'game', 'uses' => 'GameController@index'])->before('role:member');
// Just do:
Route::get('game', ['as' => 'game', 'uses' => 'GameController@index'])->before('role:member');
  1. Your role filter should check the users role, another filter should check if they're logged in or not. This was you can do:

before => 'auth|role:administrator'

This way you separate the responsibility of each role and can use them individually.

Last updated 2 years ago.
0

Thanks for your hints: I changes my Routes to the following: http://laravel.io/bin/88L37

/game ist stoll working and /admin is still running into an endless loop.

I have attached my UserController as /admin should lead to UserController@index method

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

kay899 kay899 Joined 7 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.