Support the ongoing development of Laravel.io →
Authentication
Last updated 2 years ago.
0

Short answer, no. Laravel doesn't really even ship with a built-in concept of admin users, and the examples about guards are labelled in a confusing way. Read the section on ['authorization'](

Long answer: when the docs talk about "authentication", they're referring to the tasks of logging in & out, creating & registering users, and distinguishing between authenticated (logged-in, account-having) users and guests. User roles, permissions, groups, and access controls are discussed under "authorization". Moving forward, the Gates & Policies described there are probably the best way to go, and that part of the docs introduce them fairly well.

However note that these are new to Laravel 5.1/5.2, so in older apps you're going to see a lot more hands on approaches. These can range from simply checking entries in the user table, to complicated DB relationships defining user groups and permissions sets, or perhaps whole role-management packages like Entrust.

You're still welcome to check your users table in the same way you did before.

if ($request->user()->jedirank === 9)

However I'd take the opportunity to explore the gates and policies because they are a much safer and more understandable way to approach permissions.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

muppbarn muppbarn Joined 29 Mar 2016

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.