Shankar Thiyagaraajan Shankar Thiyagaraajan -4 years ago 293
PHP Question

In Laravel Blade, Script @include works, but why @push not working?

I use Laravel 5.3,
I use laravel's default template(blade) to make layout and process my page.
Here i can't use @push to include my script,
but i can use @include to work fine.

What's the issue on these two implementations ?

Why its not support @push, but same script work fine with @include

My Code :

// My Scripts //

While accessing,

// My New Scripts //

This won't work for me.

But, if i try @include,


It's works perfectly !

what's wrong with this ?

Any solution for this ?

Thank you !

Answer Source

@include is just for importing/including a particular blade file.

To render any code you've pushed to a stack you need to use the @stack() directive:

    // My New Scripts //



Hope this helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download