Laravel blade parent section problems
I have little problem with laravel blade.
In parent view I have
@section('sidebar') @include('sidebar.widget') @include('sidebar.widget2') @show
and in few views I needed to rewrite sidebar section so I did this
@section('sidebar') @include('sidebar.widget3') @stop
But there is a problem. In views where I rewrite parent sidebar it still loads parent sidebar widget queries and inner sections like in one widget I have
@section('w-scripts') <script> // Js code </script> @stop
and Even this widget isn't loaded in some pages it still loads that w-scripts section and sql queries related to widget.
Anyone know how can I fix this? I really need parent sidebar so I don't need to copy/paste same code in nearly all views and I need different sidebar content in few views.
you can try like this
@section('sidebar') @parent @include('sidebar.widget3') @stop