Frames
3 months ago
136
5
Laravel

Relation between same Users table

Posted 3 months ago by Frames

I'm mindf*cking myself trying to make a relationship between users on same 'Users' table.

I've got 3 different roles (Admin, Coach and Runner). A user has only one role.

The issue is when I try to relate a user with role Coach and user with role Runner. Logic app is this one; I can create runners and coaches but each runner belongs only to one coach and one coach has many runners.

How can I handle this on same User table and then on User model.

When I solve this, I need to associate one coach and one runner to trainings table, but this is another brainkiller.

Please sign in or create an account to participate in this conversation.