I have a problem with Laravel 5. I get a
trying to get property of non-object
error when I try to access an eloquent property in blade.
But it's not normal because this works fine:
{{ dd($item->relation->property) }}
While this throws the error:
{{ $item->relation->property }}
What's going on there? I already tried to clear the cache, I also deleted the compiled views.
Update 19.01. 14:24 EST
Here's the content of my database (All items in my item-dump):
It stops counting at ID22:
[2016-01-19 13:17:34] local.INFO: 10
[2016-01-19 13:17:34] local.INFO: 11
[2016-01-19 13:17:34] local.INFO: 12
[2016-01-19 13:17:34] local.INFO: 19
[2016-01-19 13:17:34] local.INFO: 21
[2016-01-19 13:17:34] local.INFO: 22
[2016-01-19 13:17:34] local.ERROR: ErrorException: Trying to get property of non-object in /home/vagrant/Code/Emerald/storage/framework/views/e18baccf6428ca42183f454a47f2cc9156379826.php:22
I did Log::info($item->id) before I access any other property of this object.