mardi 26 février 2019

Laravel - retrieving attribute from within a model relationship in a blade view

I have created a relationship between products and users using a foreign key called "previous_owner". I can see when I dump the value that I'm passing to the view that the data I'm after is available under:

product->relations->product_owner->user->attributes->name

But how do I access it from within my view. I'm trying to loop through the products and then do something like:

or

But non of it works, keep getting:

" Trying to get property 'name' of non-object "

SCREEN GRAB OF THE OBJECT



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire