lundi 26 février 2018

Laravel foreach loop scope

When i use Laravel blade file foreach loop variable scope is accessible in all file, instead of it should not be able to use at the end of endforeach loop.

@foreach($user->referral as $ref)
  <tr>
    <td></td>
    <td></td>
  </tr>
@endforeach

$ref: This variable accessible out of endforeach loop.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire