diff --git a/laravel/documentation/views/templating.md b/laravel/documentation/views/templating.md
index f4098c63..9aabac87 100644
--- a/laravel/documentation/views/templating.md
+++ b/laravel/documentation/views/templating.md
@@ -5,6 +5,7 @@ ## Contents
- [The Basics](#the-basics)
- [Sections](#sections)
- [Blade Template Engine](#blade-template-engine)
+- [Blade Control Structures](#blade-control-structures)
- [Blade Layouts](#blade-layouts)
@@ -63,7 +64,7 @@ ## Blade Template Engine
#### Echoing a variable using Blade:
- Hello, {{$name}}.
+ Hello, {{ $name }}.
#### Echoing function results using Blade:
@@ -80,15 +81,46 @@ #### Render a view:
@render('admin.list')
-#### Creating loops using Blade:
+#### Blade comments:
-
Comments
+ {{-- This is a comment --}}
+
+ {{--
+ This is a
+ multi-line
+ comment.
+ --}}
+
+> **Note:** Unlike HTML comments, Blade comments are not visible in the HTML source.
+
+
+## Blade Control Structures
+
+#### For Loop:
+
+ @for ($i = 0; $i <= count($comments); $i++)
+ The comment body is {{ $comments[$i] }}
+ @endfor
+
+#### Foreach Loop:
@foreach ($comments as $comment)
- The comment body is {{$comment->body}}.
+ The comment body is {{ $comment->body }}.
@endforeach
-#### Other Blade control structures:
+#### While Loop:
+
+ @while ($something)
+ I am still looping!
+ @endwhile
+
+#### If Statement:
+
+ @if ( $message == true )
+ I'm displaying the message!
+ @endif
+
+#### If Else Statement:
@if (count($comments) > 0)
I have comments!
@@ -96,15 +128,17 @@ #### Other Blade control structures:
I have no comments!
@endif
- @for ($i =0; $i < count($comments) - 1; $i++)
- The comment body is {{$comments[$i]}}
- @endfor
+#### Else If Statement:
- @while ($something)
- I am still looping!
- @endwhile
+ @if ( $message == 'success' )
+ It was a success!
+ @elseif ( $message == 'error' )
+ An error occurred.
+ @else
+ Did it work?
+ @endif
-#### The "for-else" control structure:
+#### For Else Statement:
@forelse ($posts as $post)
{{ $post->body }}
@@ -112,35 +146,18 @@ #### The "for-else" control structure:
There are not posts in the array!
@endforelse
-
-#### The "unless" control structure:
+#### Unless Statement:
@unless(Auth::check())
- {{ HTML::link_to_route('login', 'Login'); }}
+ Login
@endunless
- // Equivalent...
+ // Equivalent to...
- ...
+ Login
-
-#### Blade comments:
-
- @if ($check)
- {{-- This is a comment --}}
- ...
- @endif
-
- {{--
- This is
- a multi-line
- comment.
- --}}
-
-> **Note:** Blade comments, unlike HTML comments, are not visible in the HTML source.
-
## Blade Layouts
@@ -173,7 +190,9 @@ ## Blade Layouts
The profile view will automatically use the "master" template thanks to Blade's **@layout** expression.
-**Important:** The **@layout** call must always be on the very first line of the file, with no leading whitespaces or newline breaks.
+> **Important:** The **@layout** call must always be on the very first line of the file, with no leading whitespaces or newline breaks.
+
+#### Appending with @parent
Sometimes you may want to only append to a section of a layout rather than overwrite it. For example, consider the navigation list in our "master" layout. Let's assume we just want to append a new list item. Here's how to do it:
@@ -188,4 +207,4 @@ ## Blade Layouts
Welcome to the profile page!
@endsection
-Notice the **@parent** Blade construct? It will be replaced with the contents of the layout's navigation section, providing you with a beautiful and powerful method of performing layout extension and inheritance.
+**@parent** will be replaced with the contents of the layout's *navigation* section, providing you with a beautiful and powerful method of performing layout extension and inheritance.