Home > Blockchain >  Trying to access array offset on value of type null
Trying to access array offset on value of type null

Time:12-29

<td> {{ $item->salary }} </td>
@if($item['advance']['advance_salary'] == NULL )
    <p>No Advance</p>
@else
    {{ $item['advance']['advance_salary'] }}
@endif
</td>
<td>
    @php
        $amount = $item->salary - $item['advance']['advance_salary'];
    @endphp
    <strong style="color: #fff;"> {{ round($amount) }} </strong>
 </td>

Trying to access array offset on value of type null already Run these commands

composer update 

php artisan cache:clear <br>
php artisan config:clear<br>
php artisan view:clear

CodePudding user response:

In some places you expect $item to be an object ($item->salary), in other you treat $item as an array ($item['advance']['advance_salary']). Fix them first and in the process probably you'll fix the error.

CodePudding user response:

Maybe $item['advance'] is null and you can't to access array offset on value of type null in $item['advance']['advance_salary']

  • Related