When I use the foreach loop for the blade of a Laravel file, the variable is available after the foreach loop, while the scope of the variable should only be inside the loop
@foreach($user->referral as $ref) <tr> <td>{{ $ref->referral_amount }}</td> <td>{{ $ref->status }}</td> </tr> @endforeach
$ ref: this variable is available outside the endforeach loop after @endforeach
source share