Skip to content

Commit

Permalink
📖 DOC: Laravel Blade Loops
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadawais committed Sep 7, 2018
1 parent 6a3675f commit b162f05
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions demo/php.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,36 @@
@default
Default case...
@endswitch

{{-- Loop --}}
@for ($i = 0; $i < 10; $i++)
The current value is {{ $i }}
@endfor

@foreach ($users as $user)
<p>This is user {{ $user->id }}</p>
@endforeach

@forelse ($users as $user)
<li>{{ $user->name }}</li>
@empty
<p>No users</p>
@endforelse

@while (true)
<p>I'm looping forever.</p>
@endwhile

@foreach ($users as $user)
@if ($user->type == 1)
@continue
@endif

<li>{{ $user->name }}</li>

@if ($user->number == 5)
@break
@endif
@endforeach


0 comments on commit b162f05

Please sign in to comment.