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

fsiddiqui's avatar

Multi Auth with Roles and Permissions

I have 4 Separate sections of logins and registrations

  1. Admin
  2. Organizer
  3. Exhibitor
  4. Visitor

Except visitor, all roles have sub roles like manager, sales person, employee

If I use Multi Auth system where I put each role in separate table like admins, organizers, exhibitors and visitors then my question is that how to manage sub roles on it????

If I use spatie/laravel-permission package which provide built-in support for roles and permission then how can I handle seprate sections of login and registration of each roles????

0 likes
3 replies
thewebartisan7's avatar

Each auth has it's own Guard in Laravel when you setup multi auth.

Then in spatie you need to specify which guard name you want to use for that role or permission you create or check. See https://spatie.be/docs/laravel-permission/v3/basic-usage/multiple-guards

It's more simple to have just one auth and multiple roles/permissions that manage, and most probably is enough.

There are some package that can help you build multi auth skeleton in case you want go with it, see:

https://github.com/mtvbrianking/multi-auth

https://bitfumes.github.io/laravel-multiauth/

1 like
jlrdw's avatar

Generally all you need is one uses table, and Authentication for a log-in required, and authorization to determine who can do and cannot do what.

Spatie uses laravel permissions. Also https://laracasts.com/discuss/channels/laravel/laravel-8-multi-auth-using-jetstream-fortify

But also did you look over jetstream teams:

https://jetstream.laravel.com/1.x/features/teams.html

Laravel has a wealth of documentation for the new version 8, I would recommend you browse over the various documentation before you decide which route to take.

1 like
fsiddiqui's avatar

Thanks @thewebartisan7 for clear the concept Follow spatie multiple-guards practice to resolve my issue and it works fine

Please or to participate in this conversation.