29.07.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Blade Templates 110<br />

.<br />

1 @for ($i = 0; $i < 10; $i++)<br />

2 The current value is {{ $i }}<br />

3 @endfor<br />

4<br />

5 @foreach ($users as $user)<br />

6 This is user {{ $user->id }}<br />

7 @endforeach<br />

8<br />

9 @forelse ($users as $user)<br />

10 {{ $user->name }}<br />

11 @empty<br />

12 No users<br />

13 @endforelse<br />

14<br />

15 @while (true)<br />

16 I'm looping forever.<br />

17 @endwhile<br />

Including Sub-Views<br />

Blade’s @include directive, allows you to easily include a Blade view from within an existing view.<br />

All variables that are available to the parent view will be made available to the included view:<br />

.<br />

1 <br />

2 @include('shared.errors')<br />

3<br />

4 <br />

5 <br />

6 <br />

7 <br />

Even though the included view will inherit all data available in the parent view, you may also pass<br />

an array of extra data to the included view:<br />

.<br />

1 @include('view.name', ['some' => 'data'])

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!