I want to write to a region in my template from the view and also from an included view thing the first view but no matter what I try it doesn't work. I have tried using @parent and @append but nothing has produced the result that I want so far.
In my layout I have the following:
@yield('scripts')
In my view primary I have the following:
@include('admin/rules/partials/_form')
@section('scripts)
// javascript #1 here
@stop
In admin/rules/partials/_form I have the following:
@section('scripts)
// javascript #2 here
@stop
So like I said I have tried using @parent after @section('scripts') and also using @append instead of @stop but nothing I do includes the two script blocks properly. The best I've had so far is javascript #1 being included once and javascript #2 being included twice. How would I do this so that each block of code is appended to the scripts region only once?
I solved it in the end I had to do the following:
@yield('scripts')
In my view primary I have the following:
@include('admin/rules/partials/_form')
@section('scripts')
// javascript #1 here
@stop
In admin/rules/partials/_form I have the following:
@section('scripts')
@parent
// javascript #2 here
@overwrite
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With