I have a list of items which I want to render in the following way:
@foreach($campaignList as $campaign)
<div class="col-md-{{12/$columns}}">
@include('admin.includes.campaign_card',['campaign'=>$campaign,'link'=>true])
</div>
@endforeach
The admin.includes.campaign_card
template (with debug )
@extends('admin.includes.base_campaign_card')
{{$campaign}} // Here the data is okay
@section('options')
{{$campaign}} //Here however I get the first item on each loop
@endsection
Basically the campaign
object within the section remains the same when looping.
It seems that the issue is related to the fact that you can have just one section with a given name at a time.
There is way to force blade to rerender with @overwrite
directive (which is not in the docs apparently) instead of @endsection
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.