I am having trouble figuring out how to attach sub entities to the user model.
Lets say I have two tables: Users and Nationality. The relationship is many to one (users:nationality), meaning every user has exactly 1 nationality. Lets say the users table has row called "nationality" which simply maps a user to their nationality in the nationality table.
Lets say i pass vanilla user model to a view $aUser = User::find(1);
will show 2
Rather than showing the id, i want the user object to include the nationality object. For example, i want to output Australia rather than the id associated with Australia.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2k6Mv2J
via IFTTT
Aucun commentaire:
Enregistrer un commentaire