Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

blumxi's avatar

Roles in Laravel 6?

Hello!

I'm learning how to use Laravel right now and I have a problem with user roles.

Basically I'd like to show/hide certain links and buttons based on the user role. (The users don't register on my web app however, I'd have to use an existing log-in service).

Should I just use "if" statements that check if a user has a specific role or is there a better way? Are there security concerns if I do it with "if" statements? Also, how would I test this? Is there a way I can give me a specific role without an corresponding account?

best regards

0 likes
4 replies
jove's avatar

You are going to use a role based system without any users to attach it to?

Snapey's avatar

create a user model in laravel and authenticate the user against the external source.

You then have a user model you can hang roles and permissions off.

How else will you determine each user's rights?

Please or to participate in this conversation.