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
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.