

<?php $__env->startSection('content'); ?>

<div class="container mt-5">
    <h1>Your Cart</h1>
    <?php if(session(key: 'cart') && count(session('cart'))>0): ?>

    <table class="table table-bordered">
        <thead>
            <tr>
                <th>Image</th>
                <th>Name</th>
                <th>Price</th>
                <th>Qty</th>
                <th>Total</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            <?php $__currentLoopData = session('cart'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $id=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td>
                    <img src="<?php echo e(asset('storage/' .$item['image'])); ?>" width="50">
                </td>
                <td><?php echo e($item['name']); ?></td>
                <td>$<?php echo e($item['price']); ?></td>
                <td>
                    <form action="<?php echo e(route('cart.update')); ?>" method="post">
                        <?php echo csrf_field(); ?>
                        <input type="hidden" name="id" value="<?php echo e($id); ?>">
                        <input type="number" name="quantity" value="<?php echo e($item['quantity']); ?>" min="1">
                        <button type="submit" class="btn btn-sm btn-succes">Update</button>
                    </form>
                </td>
                <td>$<?php echo e($item['price'] * $item['quantity']); ?></td>
                <td>
                    <form action="<?php echo e(route('cart.remove' ,$id)); ?>" method="POST">
                        <?php echo csrf_field(); ?>
                        <button type="submit" class="btn btn-sm btn-danger">Remove</button>
                    </form>
                </td>
            </tr>      
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
    </table>
    <?php else: ?>
    <p>Your cart is Empty...</p>
    <?php endif; ?>
    
</div>

<a href="<?php echo e(route('cart.checkout')); ?>" class="btn btn-secondary">Place Order</a>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\khruk\Desktop\ecommerce\megastore\resources\views/cart/index.blade.php ENDPATH**/ ?>