am tryna pass data to the pdf generator,
where I got variable dd($employees['fields'])
and it has this format
$employees = [
'fields' => [
"id" => null,
"names" => null,
"gender"=> null,
"base"=>"1",
]
]
but in the process of pass data into the package it is giving me that error
$pdf = PDF::loadView('pdf.newslip', ['data' => $data, 'fields' => [
"base" => ($employees['fields']['base'] == "1") ? 1 : 0,
]])->setOptions([
'defaultFont' => 'sans-serif',
'isHtml5ParserEnabled' => true,
'isRemoteEnabled' => true
]);
when trying to acess this
'fields' => [
"base" => ($employees['fields']['base'] == "1") ? 1 : 0,
]
can anyone help please?
am hoping that i will be able to accesss $employees['fields]['base']
Double-check that the variable is actually an array before accessing its fields. Try using is_array($var)
or var_dump($var)
to debug, this help you to get the idea what's the problem.