Below i provided two example of displaying product card in a loop. The first one seems to me more convenient but i'm worrying about performance because of this @include inside the loop. As this task is pretty common i would like to choose the best way.
Case 1. Using @include:
search.blade.php
<div id='search-results'>
@foreach($items as $item)
@include('items._item')
@endforeach
</div>
_item.blade.php
<div>
<div class='item-title'></div>
<div class='item-description'></div>
</div>
Case 2. Without @include:
search.blade.php
<div id='search-results'>
@include('items._items_list')
</div>
_items_list.blade.php
@foreach($items as $item)
<div class='item-title'></div>
<div class='item-description'></div>
@endforeach
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2xi4ckt
via IFTTT
Aucun commentaire:
Enregistrer un commentaire