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

artur33s's avatar

What choose Multi Auth? Guards or Roles?

I have always chosen method Role. In this project, which I would like to do, there will be about 5 registration methods and in each registration the fields will change. And each type of registration can be called a role, it will have its own ORM structure. and another html. I tried to find the answer in Google and found 2 options (WITH ROLES OR GUARDS). I would like to hear advice from experienced developers which option is better? Thanks all!

0 likes
2 replies
aurawindsurfing's avatar
Level 50

Hey @artur33s

A very simple answer would be to use use both.

Guards should "guard" your application or parts of it from users that should not be able to access it eg. login/password. It is also called AUTHENTICATION https://laravel.com/docs/8.x/authentication

Roles should allow authenticated user to perform certain actions therefore giving such role AUTHENTICATION to do it. https://laravel.com/docs/8.x/authorization

As you can see you can also use Gates and Policies. Role would be more granular in my view then Gate or Policy.

1 like

Please or to participate in this conversation.