lundi 4 janvier 2016

Can Laravel hasOne be used with belongsToMany?

Let's say I have two tables:

Users: id, name, country_id

Countries: id, name

Of course each user can only have one country, but each country is assigned to multiple users.

So would it be safe to have a User model that utilizes hasOne and a Country model that uses belongsToMany method?

Documentation makes it seem like you can't mix and match different types of relationships.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1OvBEbG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire