Laravel Blade Stacks

One thing that I often forget about is a nice feature in Laravel that allows you to push scripts or other blocks of code into another part of your templates, so for example:

    <script src="/example.js"></script>

You can do this multiple times and each one will be pushed on to the stack, when you’re ready to dump and display them, you can dump to view using @stack:

    <!-- Head Contents -->


Nothing ground breaking here, but incredibly useful. You can read more about it on the Laravel documentation.