Home > Net >  errorexception trying to get property 'name' of non-object
errorexception trying to get property 'name' of non-object

Time:10-25

enter image description here

As You can see after dd()

I am getting an object of "Note Category".

$note->category->name

it returns an error called trying to get property of non-object

enter image description here

CodePudding user response:

dd() will stop execution, so you'd only get the dump for the first item in your loop. Try dump(...) instead, which will dump the same data as dd() but continue execution. There most likely is a note in your loop that doesn't have a category.

  • Related