I'm building a Laravel Sanctum API project for my portfolio. The project is a system where users and trainers exist, and it basically allows trainers to create workout plans for users. Without going too deep into the workout side of things, here's my situation:
I was planning to create a single users table to authenticate everyone with a bearer token, and create an intermediate table containing the FK of clients and the FK of trainers, along with additional data like start date, etc. The thing is, when I start defining the relationship methods between tables, I realize I can't use a belongsTo (for the client-trainer relationship) because I can't tell it which table to look in for the client — the clients table has no fields referencing any trainer ID. I think I don't have issues with the hasMany (trainer to clients), but I still need to store related data like the start date, which is why I think the intermediate table makes sense.
My question is (sorry for the long explanation): does what I'm planning make sense and could it be considered good practice (or at least not bad practice)? Or is it a mess?
pd: i've used AI to translate this, because I don't really domain English yet. Sorry :(