Closed RadoslavAngelov closed 6 years ago
As you can the name is a attribute , its not the member of the main table, so while retrieving the name
, you need to tell the system that to include it
Products::where('id', 1)->get('*', 'name');
*
-> to get all the values from the main table and name
attributes to be included.
To retrieve all the attribute values check this link
Quick View
Products::where('id', 1)->get('attr.*');
Let me know if you find any issue understanding this, i am trying make the documentation more clear.
Yes, thank you this works.
Hello,
how can you take a model instance with all its attribute values. For example I have Product with attribute name. If I want to update the value of name I can make:
`$product = Products::find(1);
$product->name = 'Not a Flamethrower';
$product->save();`
but how can I display
$product->name
. If i try todd($product->name)
the result isnull