I have this Eloquent model.
$order = Order::find(1);
When I echo $order->Status; this should throw an Undefined Property Notice because no such property Status exists in the object.
If I do this $order = new stdClass; and echo the same thing I will get the Undefined Property notice.
Why I do not get it in Eloquent models?
The problem is when I pass the $order model to the view if I misspell a property Laravel does not display the error that the property is undefined. When I var_dumb I just get NULL.
The reason why of this behevior will be clearer If you take a look at how getAttribute is implemented here https://github.com/illuminate/database/blob/4.2/Eloquent/Model.php
I'm not sure, but maybe you should override that class.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community