I think you can use a one-to-many relationship. And you can check this here.
Mar 28, 2023
4
Level 1
laravel relation ship
I'm asking this because I'm new to laravel and PHP in general, I want to build up a relation ship between:
users
domains
user_domains
A user has one domain, but one domain can be assigned to many different users. Should I follow this approach has-one-through?
laravel.com/docs/10.x/eloquent-relationships#has-one-through
Meaning:
A domain HasManyThrough() users (using user_domains)
A user HasOneThrough domain (using user_domains)
Please or to participate in this conversation.