sql - How can I return data from a foreign table when querying the USER in Laravel? -


for example, let's user table has column references foreign table height. if use:

return \auth::user()->height_id; 

in controller id of primary key referenced in height table, how can retrieve data that's inside referenced row in foreign table?

you should try

return \auth::user()->height()->your_height_table_field; 

this expected made relations between user , height model.
read more..


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -