[Solved] i need to print currently no products in my laravel page using else condtion [closed]


Your question is unclear, but I think I know what you want to accomplish. Before your foreach you need to check the products count. If products are found, then loop them, if not, display a message. Try this:

@if(count($data['products']))
   
@foreach ($data['products'] as $list)
    <div class="col-6 col-md-4 tt-col-item">
        <div class="tt-product thumbprod-center">
            <div class="tt-description">
                <div class="tt-row">
                                                
                </div>
                <h2 class="tt-title"><a href="{{url('/Shop/'.$data['webname'].'/products/'.$list['id'].'/details')}}">{{
   $list['name'] }}</a></h2>
            </div>
        </div>
    </div>
</div>                                      
@endforeach

@else
   <p>Currently no products.</p>
@endif

3

solved i need to print currently no products in my laravel page using else condtion [closed]