Skip to content

Commit

Permalink
Document @continue and @break blade directives
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Feb 26, 2016
1 parent 9895254 commit 4e3d5d5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions blade.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,26 @@ In addition to conditional statements, Blade provides simple directives for work
<p>I'm looping forever.</p>
@endwhile

When using loops you might need to end the loop or skip the current iteration:

@foreach ($users as $user)
@if($user->type == 1)
@continue
@endif
<li>{{ $user->name }}</li>
@if($user->number == 5)
@break
@endif
@endforeach

You may also include the condition with the directive declaration in one line:

@continue($user->type == 1)

@break($user->number == 5)

#### Including Sub-Views

Blade's `@include` directive, allows you to easily include a Blade view from within an existing view. All variables that are available to the parent view will be made available to the included view:
Expand Down

0 comments on commit 4e3d5d5

Please sign in to comment.