-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use roles? #61
Comments
I'm having the same issue. Logging in with a role other than admin results in redirect loop. |
I'm having the same issue.. |
I found the soluation . config.php return [
'prefix' => 'admin',
'filter' => [
'auth' => [
**App\Http\Middleware\Authenticate::class,**
**App\Http\Middleware\OnlyAdmin::class,**
],
**'guest' => App\Http\Middleware\RedirectIfAuthenticated::class,**
], OnlyAdmin.php <?php
namespace App\Http\Middleware;
use Closure;
class OnlyAdmin
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
// var_dump($request->user()->is('testadmin'));
// if (!$request->user()->is('admin')) {
// // return response('OnlyAdmin.', 401);
// return redirect()->route('admin.login.index');
// }
return $next($request);
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have an admin account that it works ok, but now I wanted to create another account type so I went to Users -> Roles and created another one and then created a user for that role, but when I try to log in with that user It gives my a redirection problem in the browser.
What am I missing?
Thanks
The text was updated successfully, but these errors were encountered: