Let's say I have this:
$data = [
'total' => $itemNull ? 0 : $issueData['workedHours'] * $itemFound->sale_price,
'tax' => $taxRate * $data['total'],
];
That line throws undefined
and I understand the reason, since $data
it is not fully build I cannot access it. So here is the question, is there any way to access the 'total'
field??
Or define it first
$total = $itemNull ? 0 : $issueData['workedHours'] *$itemFound->sale_price;
$data = [
'total' => $total,
'tax' => $taxRate * $total,
];