Stacks
Blade allows you to push to named stacks which can be rendered in another view or layout.
Useful for javascript libraries required by child views
<!-- Add to the stack -->
@push('scripts')
<script src="/example.js"></script>
@endpush
Render the stack
<head>
<!-- Head Contents -->
@stack('scripts')
</head>
Prepend to the beginning of a stack
@push('scripts')
This will be second...
@endpush
// Later...
@prepend('scripts')
This will be first...
@endprepend
Comments