When I use Laravel blade file foreach loop, the variable is accessible after the foreach loop, whereas the scope of the variable should be only within the loop
@foreach($user->referral as $ref)
<tr>
<td>{{ $ref->referral_amount }}</td>
<td>{{ $ref->status }}</td>
</tr>
@endforeach
$ref: This variable is accessible outside endforeach loop after @endforeach
$refoutside of loop.