jeudi 16 décembre 2021

Property [image] does not exist on this collection instance. / Laravel - with() Method

I get data with relations from controller but can't use in blade

Controller..

$employees = Post::where('user_id', $user_id)->with('people')->get();

Blade, I use in foreach like ..

$employee->people->image

But it gives error

Property [image] does not exist on this collection instance.

When I dd($employees)

enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire