lundi 23 avril 2018

Relationship between two tables in Eloquent (Laravel) based on a secondary table

Maybe I don't know the terminology for this, but I'm trying to create a HasMany relationship between Person and Car object.

Person:
id | user_name | created_at ....


Car:
id | make | model | year ...

Person_Car: 
car_id | person_id

So obivously the relationship is defined by linking through the Person_Car relationship. Maybe I'm brain farting but I've forgotten what that this relationship is called and how to define Person as hasMany Cars

What's the name of the relationship and how can I define it in a Laravel Eloquent object?

Thanks,

gg



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2K978Xd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire