AndMex adlı üyeden alıntı: mesajı görüntüle
Merhaba,
foreach ile ikon çektiriyor ve listeletiyorum ancak buna sınırlama getirmek istiyorum. Max 6 tanesini göstersin istiyorum, bunu aşağıdaki kodda nasıl yapabilirim? yardımcı olabilir misiniz?

@php
$terms_ids = $row->terms->pluck('term_id');
$attributes = \Modules\Core\Models\Terms::getTermsById($terms_ids);
@endphp
@if(!empty($terms_ids) and !empty($attributes))
    @foreach($attributes as $attribute )
        @php $translate_attribute = $attribute['parent']->translateOrOrigin(app()->getLocale()) @endphp
        @if(empty($attribute['parent']['hide_in_single']))
            

                        @php $terms = $attribute['child'] @endphp
                        @foreach($terms as $term )
                            @php $translate_term = $term->translateOrOrigin(app()->getLocale()); @endphp
                            
                            <th>
                            <div class="listing_feature_iconbox mb30">
                                <div class="icon float-left mr10">
                                    @if($term->icon)
                                        <text class="ipucu"><span class="ipucuMetniSag">{{$translate_term->name}}</span><span class="{{ $term->icon }}"></span></text>
                                    @else
                                        <span class="fa fa-check"></span>
                                    @endif
                                </div>
                            </div>
                            </th>
                        @endforeach
 
        @endif
    @endforeach
@endif
Şimdiden teşekkür ederim.
Collection kullaniyorsaniz take isinizi gorur.

https://laravel.com/docs/8.x/collections#method-take