title: how can we define a loop variable for foreach loop in laravel php blade tempalte
body: <p>I tried this but it got printed in fronted</p>
  
  <pre class="lang-html prettyprint-override"><code>{{ $x=1}}
  @if(count($bookings))
      @foreach ($bookings as $data)
          &lt;tr&gt;
              &lt;td&gt;{!! $x !!}&lt;/td&gt;
              &lt;td&gt;{!! $data-&gt;service-&gt;id !!}&lt;/td&gt;
              &lt;td&gt;{!! $data-&gt;service-&gt;title !!}&lt;/td&gt;
              &lt;td&gt;{!! $data-&gt;full_name !!}&lt;/td&gt;
              &lt;td&gt;{!! $data-&gt;email !!}&lt;/td&gt;
              &lt;td&gt;{!! $data-&gt;phone !!}&lt;/td&gt;
              &lt;td&gt;{!! date('d-m-Y', strtotime($data-&gt;booking_date))  !!} {!! $data-&gt;slot_start_from !!}&lt;/td&gt;
          {{$x++}}
      @endforeach
  </code></pre>
  
  <p>This code not working value of x got printed . i don't want to use code php code here any good suggestion welcome</p>