What is the difference between Section and Stack in Blade?

前端 未结 3 1843
忘了有多久
忘了有多久 2021-02-03 20:50

We can use a section to define some HTML and then yield that somewhere else.

So why do we have stacks? https://laravel.com/docs/5.2/blade#sta

3条回答
  •  不知归路
    2021-02-03 21:36

    Stack is someway appropriate for scripts , with stack you can Append as much as you need .

    @push('scripts')
        
     @endpush
    

    Append …

    
    
    
    @stack('scripts')
    
    

    As you can see the scripts stack will be appended under the script tag of example.js . So you can push special scripts for each view .

提交回复
热议问题