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

It sounds like you have a single user with different accounts. One account would be a 'standard' user and the other would be a 'business' user.

If we think of it this way, you can have a single users table with seperate tables for standard and buisness accounts. This will allow you to have a single use model for authentication and user interaction, while maintaining the profile (account) information for each user. You can then seperate business logic based on the current account for the user, and you have the ability to add other types of profiles in the future!

If all users have a 'standard' profile as part of their definition, you can just roll those columns into the users table, and link a business profile to each business user. This gives you the same benefits as above.

Was the following clear enough? or does that info not help with your issue? If not, can I get some more specifics about your question?

Last updated 2 years ago.
0

Thanks for the reply...It kind of makes sense, but to be fair I have been doing a lot of reading about polymorphic links and it has broken me :)

So essentially what I am trying to do is create two apps that integrate together. Both apps need to have authentication, now what I would have done if creating this just in PHP without a framework is had a duplicate authentication mechanism.

Ill try and give an example of what I am trying to do as it might just be the case I am over thinking things...

Employee logs in checks what jobs he has to do, he can only mark them as completed.

Manager logs in and he can create jobs for the employee

Both have different dashboards and different account access. An employee cant be an employee and a manager cant be an employee either so the actions are totally separate. The only difference is the manager will have a totally different profile to a user and this was the part I was getting stuck on. If it was PHP i would separate into different tables rather than having 1 table with loads of empty columns for a user profile and vice verse for a manager.

I hope that make sense :)

Thanks!

Last updated 2 years ago.
0

I can understand about the polymorphic relations.

You explanation makes sense, and I can see how my original idea would be more difficult than helpful. :)

There is ollieread's multiauth package that may give you some help. It seems that with this package you could do something like...

Auth::manager()->check(); // User is a manager
Auth::employee()->check(); // User is an employee

You could have an employee login, where you would attempt to login employees, and another login for managers. Could you seperate out your views, controllers, logic, etc. from there?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

toneee toneee Joined 28 Aug 2014

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.