Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel foreach first

@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
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #foreach
ADD COMMENT
Topic
Name
8+9 =