sage-directives icon indicating copy to clipboard operation
sage-directives copied to clipboard

@posts should provide Blade's magic $loop variable

Open markjaquith opened this issue 5 years ago • 1 comments
trafficstars

It would be great if you could use Blade's magic $loop variable within @posts blocks.

For reference: https://github.com/laravel/framework/blob/7.x/src/Illuminate/View/Concerns/ManagesLoops.php

markjaquith avatar Oct 05 '20 23:10 markjaquith

I need to do this with @repeat as well

Log1x avatar Oct 05 '20 23:10 Log1x

Is it possible to show an example of how to use this?

I get Warning : Undefined variable $loop

I am trying to use it like

@posts
     @if ($loop->even)
          <div id="1">
     @else
          <div id="2">
     @endif
 @endposts

jopfre avatar Aug 29 '23 17:08 jopfre