Answers for "foreach loop in script in laravel"

PHP
0

for each loop syntax in laravel

@foreach ($users as $user)
    @if ($loop->first)
        This is the first iteration.
    @endif

    @if ($loop->last)
        This is the last iteration.
    @endif

    <p>This is user {{ $user->id }}</p>
@endforeach
Posted by: Guest on November-18-2020
0

loop foreach laravel with number

@foreach($users as $index => $user)
  <td>{{ $index + 1 }}</td>
  <td>{{ $user->username }}</td>
@endforeach
Posted by: Guest on October-24-2021

Code answers related to "foreach loop in script in laravel"

Browse Popular Code Answers by Language