11.08.2017 Views

codebright

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Blade 101<br />

11 We have a template!<br />

12 @stop<br />

As you can imagine, the head section has been injected with our additional CSS file, and the source<br />

for our page now looks like this:<br />

1 <br />

2 <br />

3 <br />

4 <br />

5 <br />

6 <br />

7 <br />

8 <br />

9 Hurray!<br />

10 We have a template!<br />

11 <br />

12 <br />

Do you remember how the head section had some default content between the ‘@section’ and<br />

‘@show’? Well, we might wish to append to this content, rather than replace it. To do this we can<br />

use the @parent helper. Let’s modify our child template to use it, like this:<br />

1 <br />

2<br />

3 @extends('layouts.base')<br />

4<br />

5 @section('head')<br />

6 @parent<br />

7 <br />

8 @stop<br />

9<br />

10 @section('body')<br />

11 Hurray!<br />

12 We have a template!<br />

13 @stop<br />

The ‘@parent’ helper tells Blade to replace the parent marker, with the default content found within<br />

the parent’s section. That sentence might sound a little confusing, but it’s actually quite simple. Let’s<br />

have a look at how the source has changed for some clarity.

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

Saved successfully!

Ooh no, something went wrong!