Level 54
its best for you to identify which relationship each model has with each other.
- anyone that needs to login needs to be a
User - if a
Usercan also be aCandidate, then in yourCandidatemodel you will want to add auser_idand definehasOnerelationshipUserhasOneCandidate. -
Usercan have many roles, andRolecan have manyUserso you want to define abelongsToManyrelationship both ways between those models.
depending on the complexity of your Role its best to assign Permissions to Role with a package such as
https://github.com/spatie/laravel-permission
1 like