dimanche 19 avril 2020

Laravel Blade: If php code is wrapped with a display none, is it still run?

I'm trying to change the display fields from javascript. If a user selects from a drop down to show only in-stock items, I grab the id of the div and change the display from none to block. Is there any issue with it doing this way? Since the php code is not a query, I'm assuming it shouldn't be an issue if all the foreach statements get run and then their visibility controlled by the display on the div.

 <div style="display:none" id = "no-filter">
    @foreach ($collection->products('no-filter') as $product)
        @include('prod-list')
    @endforeach
</div>

 <div style="display:none" id = "sale">
    @foreach ($collection->products('sale') as $product)
        @include('prod-list')
    @endforeach
</div>

<div style="display:none" id = "in-stock">
    @foreach ($collection->products('in-stock') as $product)
        @include('prod-list')
    @endforeach
</div>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire