Othmane Bouhenna :
can someone please show where is the error ?
$material = DB::table('material_user')->where('material_user.id', $id)
->leftjoin('users', 'users.id','=','material_user.user_id')
->leftjoin('materials', 'materials.id','=','material_user.material_id')
->select('users.first_name','users.last_name','users.sexe','materials.serial','materials.name','material_user.created_at')
->get();
dd($material->first_name);
Exception Property [first_name] does not exist on this collection instance.
Sehdev :
get()
returns a collection. So you have to iterate over the collection to get the first_name
for e.g
foreach ($material as $object)
echo $object->first_name;
endforeach
Or you can get the single record using below & can access first_name directly
$object = $material->first();
echo $object->first_name