<div class="mini_cart_wrapper"> 
<?php 
$cart_counter = \App\Models\Cart::where('session_id',Session::getId())->count('id'); 
$carts = \App\Models\Cart::where('session_id',Session::getId())->get();
$subtotal_cart = [];
?>
<a href="{{url('cart')}}"> 
    <span class="cart-icon">
        <i class="fa fa-shopping-cart"></i>
    </span>
    <span class="cart-no">({{$cart_counter}})
    </span>
</a>  
@if(count($carts))
<div class="mini-cart-content">
    @foreach($carts as $cart)
    <?php 
        $subtotal_cart[] = $cart->product->selling_price * $cart->quantity;
    ?>
    <div class="cart-img-details">                                      
        <div class="cart-img-photo">
            <a href="{{url('/p')}}/{{$cart->product->slug}}">
            <img src="{{ asset('public/uploads/images') }}/{{@$cart->product->productImage->image}}" alt="{{$cart->product->name}}" /></a>
            <span class="quantity">{{$cart->quantity}}</span>
        </div>
        <div class="cart-img-contaent">
            <a href="#"><h4>{{$cart->product->name}}</h4></a>
            <span>₹ {{$cart->product->selling_price}}</span>
        </div>
        <div class="pro-del"><a href="{{url('del/')}}/{{$cart->id}}/session_id/{{$cart->session_id}}"><i class="fa fa-times-circle"></i></a>
        </div>
    </div>
    <div class="clear"></div>
    @endforeach
    <div class="cart-inner-bottom">
        <p class="total">Subtotal: <span class="amount">₹ {{array_sum($subtotal_cart)}}</span></p>
        <div class="clear"></div>
        <p class="cart-button-top"><a href="{{url('checkout')}}">Checkout</a></p>
    </div>
</div>
@endif
</div>