

<?php $__env->startSection('title', 'Welcome'); ?>

<?php $__env->startSection('content'); ?>
<section class="py-9 border-bottom border-white border-5">
  <div class="container mt-5 mb-5">
    <div class="container-fluid mt-5 mb-5">
      <div class="row g-2">
        <div class="col-md-3">
          
          <div class="brand p-2">
            <div class="heading d-flex justify-content-between align-items-center">
              <h6 class="text-uppercase">Categories</h6>
              <span>--</span>
            </div>
            <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="d-flex justify-content-between mt-2">
              
              <a href="<?php echo e(route('category.index', $cat)); ?>"><?php echo e($cat->name); ?></a>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </div>
          
        </div>
        <div class="col-md-9">
          <div class="row g-2">
            <div class="col-md-4">
              <?php if($category->items->count() > 0): ?>
              <?php $__currentLoopData = $category->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <div class="product py-4">
                
                <div class="text-center"> <a href="<?php echo e(route('item.show', $item)); ?>"><img src="<?php echo e(asset('storage/'.$item->image)); ?>" width="200"> </a></div>
                <div class="about text-center">
                  <h5><?php echo e($item->name); ?></h5>
                  <span>$<?php echo e($item->price); ?></span>
                </div>
                <div class="cart-button mt-3 px-2 d-flex justify-content-between align-items-center">
                  
                  <?php if(auth()->check()): ?>
                    <?php if(!\Cart::session(auth()->user()->id)->get($item->id)): ?>
                    <form method="POST" action="<?php echo e(route('add.to.cart', $item)); ?>">
                      <?php echo csrf_field(); ?>
                      <button class="btn btn-primary btn-block">Add to Cart</button>
                    </form>
                    <?php else: ?>
                      <button type="button" disabled class="btn btn-primary btn-block">Added to Cart</button>
                    <?php endif; ?>
                  <?php else: ?>
                    <a href="<?php echo e(route('login')); ?>" class="btn btn-primary btn-block">Login</a>
                  <?php endif; ?>
                </div>
              </div>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              <?php else: ?>
              <h3 class="text-center">No items</h3>
              <?php endif; ?>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\chittar\resources\views/category/index.blade.php ENDPATH**/ ?>