Using @while Control structures in Blade

Problem

You want to loop in your Blade template until a condition is met.

Solution

Use the @while control structure.

<html>
<body>
  <p>An array of strings.</p>
  <ul>
    @while ($item = array_pop($items))
      <li>{{{ $item }}</li>
    @endforeach
  </ul>
</body>
</html>

Discussion

todo

comments powered by Disqus