@php $cart = session('cart', ['items' => []]); $ids = array_keys($cart['items']); $dishes = count($ids) ? \App\Models\Dish::whereIn('id',$ids)->get()->keyBy('id') : collect(); $count = 0; $subtotal = 0; foreach($cart['items'] as $id => $qty){ $dish = $dishes[$id] ?? null; if(!$dish) continue; $q = is_array($qty) && isset($qty['qty']) ? (int)$qty['qty'] : (int)$qty; $count += $q; $subtotal += ((float)$dish->price) * $q; } $belowMin = false; $atCapacity = false; $minSubtotal = 0; $capacityMsg = null; try { $minSubtotal = (float) \App\Models\Setting::get('order.min_subtotal', 0); $belowMin = $subtotal > 0 && $subtotal < $minSubtotal; $maxOpen = (int) \App\Models\Setting::get('capacity.max_open_orders', 0); if($maxOpen > 0){ $atCapacity = \App\Models\Order::openOrdersCount() >= $maxOpen; } if($atCapacity) { $capacityMsg = 'High kitchen load – prep may be slower'; } } catch (Throwable $e) { /* swallow */ } @endphp @if($count > 0)

Your Cart

{{ $count }} item{{ $count!==1?'s':'' }} • ₦{{ number_format($subtotal,2) }}
@if($belowMin)
Add ₦{{ number_format($minSubtotal - $subtotal,2) }} more to reach minimum.
@endif @if($capacityMsg)
{{ $capacityMsg }}
@endif
View Cart @auth Checkout @else Login @endauth
@endif