laravel/framework — pull request #3813 by cangelis (2014-03-06 23:11:55+00:00)
Title: [Proposal] A new blade statement: stack

`@stack` statement provides easy way to `@push` contents into a container from multiple locations.
# Example use-case

The most beneficial use-case would be to push javascript code to the before `

` javascripts. An example:

**layout.blade.php**

@include('something')
@include('someone')

@stack('scripts')

**something.blade.php:**

// Only this page needs helloWorld() function so defining this function here makes sense
Hello!
@push('scripts')

@endpush

**someone.blade.php**

// this page has a datepicker so jquery.datepicker.js should be included

@push('scripts')

@endpush

The resulting content for `@stack('scripts')` would be: