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

nariels's avatar

user with multiple accounts as ROLES

new to Laravel and there's something I have been battling with.

I am designing a system where a user can have multiple accounts.

e.g A user registered on the app can decide to become a business that sells or become a delivery guy that delivers etc. as such they can switch roles and interact with the app as a business, i.e if commenting on a post-it will show the business name, or as a user, it will show the username.

without the need to log out because it's just a user who has multiple business accounts.

I already employed Spatie roles and permission package. A user registers with user permission, if he requests to become a business, a new role will be added to him. however, each business has different attributes I am using a dynamic database table for each business type e.g delivery service, plumber, etc so using roles and permission, how can I know which database table to fetch. Note: when a user switches roles, the switched role can interact with the app normally, like comment on posts, message someone, etc. each role has its own dashboard.

Thought about multi-tenancy. i.e A user registers with user permission, if he requests to become a business, a dynamic database will be created for him. so in his dashboard, he can see all roles and switch according. but the issue here is how can I get all the posts from all businesses. since they are stored in different databases.

when a user logs into the app, the homepage shows all the posts from all businesses, interact, comment on all the available posts. then can switch to a business, make his own post, and can still interact with other people and business post.

I also thought about using microservices and splitting the accounts. A similar feature is how Facebook page feature works

Please I am not really asking for just a fixed. I want opinions, thoughts, solutions

I am a web developer and I don't know much about software development

0 likes
0 replies

Please or to participate in this conversation.