foreach ($data as $dt_row) {
if ($coordinator != $dt_row->coordinator->full_name) {
$sheet->setCellValue('A' . $row, "Zmiana " . $dt_row->shift_code . " - " . $dt_row->coordinator->full_name);
$sheet->setCellValue('B' . $row, $dt_row->coordinator->position);
$sheet->getStyle('A' . $row . ':B' . $row)->getFont()->setBold(true);
$coordinator = $dt_row->coordinator->full_name;
$row ;
}
$sheet->setCellValue("A" . $row, $dt_row->user->full_name);
$sheet->setCellValue("B" . $row, $dt_row->user->position);
$row ;
}
returns "Trying to get property 'full_name' of non-object" data structure looks like this
{
"shift_code": "B",
"coordinator": {
"full_name": "name surname",
"position": "Koordynator dzia\u0142u Kompletowania\/Monta\u017cu", ///language code here
"shift_code": "B"
},
"user": {
"full_name": "surname_emp name_emp",
"position": "Starszy pracownik dzia\u0142u Kompletowania\/Monta\u017cu"
}
}
I think i am correctly trying to get the property but mb i cant see something
CodePudding user response:
fixed had to add ->data foreach ($data->data as $dt_row) thanks for help