<?php 
    $cart = Session::get('cart');
?>
<div class="row col-sm-12">
@foreach($data as $item)
@php $status = 0; @endphp
        <div class="col-lg-2 col-md-4 col-sm-6 col-xs-3 col-6 bg pos-item p-5">
    <div class="thumbnail">
        <div class="caption">
            <center><h4 class="text-danger"><b>{{ $item->item_house }}</b></h4>
            <p class="text-blue"><b>{{ $item->item_price }}$</b></p></center>
            @if(!$cart)
            <p class="btn-holder"><a href="#" data-id="{{$item->id}}" class="btn btn-default btn-block text-center btn-add-to-cart" role="button">Add To Cart</a> </p>
            @else
                @foreach($cart as $key => $item_cart)
                
                    @if($item_cart['item_id']==$item->id)
                        <p class="btn-holder"><a href="#" data-id = "{{$item->id}}" class="btn btn-default btn-block text-center" role="button">Added To Cart</a> </p>
                        <?php $status = 1 ?>
                    @endif
                @endforeach
                @if($status != 1)
                <p class="btn-holder"><a href="#" data-id="{{$item->id}}" class="btn btn-default btn-block text-center btn-add-to-cart" role="button">Add To Cart</a> </p>
                @endif
            @endif
            @if(Auth::user()->block_permission==1)
                <p class="btn-holder"><a href="#" data-id="{{$item->id}}" class="btn btn-block btn-default text-center btn-block-item" role="button">Block Item</a> </p>
            @endif
        </div>
    </div>
</div>
@endforeach
</div>