Perhaps the solution to this issue is not represented by the title.
Have three entities:
BUSINESS RULES
For each relationship between an User and a Status i need to create and associate to the User a different Profile.
User can change back to an related Status and "reassign" your own Profile referred to the status.
WORKFLOW EXAMPLE
user1 (User) became student (Status). Give him an student profile (Profile).
user1 (User) is now a collaborator (Status). Give him a collaborator profile (Profile).
user1 (User) became student (Status) again. Give him your old student profile (Profile).
Well, with above information i know:
User belongs to many Status and Status belongs to many User.
Now, i have the junction table user_status
that receive user_id
and status_id
to construct the relationship.
My problem is:
Using Laravel Eloquent Relationship, how i can create a new Profile, keeping the constraints, always when i have a new relationship between User and Status?
If I was not clear in the explanation of the problem, let me know so i can clarify something