# 🚀 SPICES ECOMMERCE - QUICK SETUP GUIDE

## Installation & Setup (5 minutes)

### Step 1: Install Dependencies
```bash
cd /Users/hasib/Herd/logicleaf-ecom
composer install
npm install
```

### Step 2: Environment Setup
```bash
cp .env.example .env
php artisan key:generate
```

### Step 3: Database Configuration
Edit `.env` file and set your database details:
```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=spices_ecommerce
DB_USERNAME=root
DB_PASSWORD=
```

### Step 4: Run Migrations & Seed Data
```bash
php artisan migrate
php artisan db:seed
```

This will create:
- Default admin user
- 5 sample categories
- 6 sample products
- Hero section

### Step 5: Create Storage Link
```bash
php artisan storage:link
```

### Step 6: Build Assets
```bash
npm run build
```

### Step 7: Start Server
```bash
php artisan serve
```

🎉 **Your site is ready at:** `http://localhost:8000`

---

## 🔐 Admin Dashboard Access

**URL:** `http://localhost:8000/admin/dashboard`

**Credentials:**
- Email: `admin@spices.com`
- Password: `password123`

⚠️ **Change these credentials immediately in production!**

---

## 📋 What's Included

✅ Complete admin panel with CRUD for:
- Products (with image upload)
- Categories
- Hero section
- Orders management

✅ Customer frontend with:
- Product listing & filtering
- Real-time search
- Shopping cart
- Checkout process
- Responsive design

✅ Database with:
- Users (admin & customer)
- Products
- Categories
- Orders
- Cart items
- Hero section
- Featured products

---

## 🛍️ First Steps

1. **Login to Admin:** Go to `/login` with admin credentials
2. **Add Categories:** Go to `/admin/categories` → "Add Category"
3. **Add Products:** Go to `/admin/products` → "Add Product"
4. **Customize Hero:** Go to `/admin/hero` → Edit section
5. **View Frontend:** Go to `/` to see your store

---

## 📁 Key Directories

| Directory | Purpose |
|-----------|---------|
| `app/Http/Controllers/Admin/` | Admin controllers |
| `app/Livewire/` | Livewire components |
| `app/Models/` | Database models |
| `resources/views/admin/` | Admin panel views |
| `resources/views/layouts/` | Layout templates |
| `resources/views/livewire/` | Livewire component views |
| `database/migrations/` | Database migrations |
| `database/seeders/` | Seed data |

---

## 🔧 Common Commands

```bash
# Clear cache
php artisan cache:clear

# Reset database
php artisan migrate:fresh --seed

# Create new user
php artisan tinker
>>> App\Models\User::create(['name' => 'Name', 'email' => 'email@test.com', 'password' => bcrypt('password'), 'is_admin' => true])

# Run tests
php artisan test
```

---

## 🌐 Routes Overview

| Path | Description |
|------|-------------|
| `/` | Homepage with hero & featured products |
| `/products` | All products with filters |
| `/cart` | Shopping cart (auth required) |
| `/checkout` | Checkout form (auth required) |
| `/login` | User login |
| `/register` | User registration |
| `/admin/dashboard` | Admin dashboard (admin only) |
| `/admin/products` | Product management |
| `/admin/categories` | Category management |
| `/admin/hero` | Hero section editor |
| `/admin/orders` | Order management |

---

## 🎨 Customization Tips

### Change Colors
Edit `tailwind.config.js` to change the spice color palette.

### Change Logo
Replace the emoji logo in `resources/views/layouts/app.blade.php`.

### Change Company Info
Update footer text in `resources/views/layouts/app.blade.php`.

### Add New Fields to Products
1. Create migration: `php artisan make:migration add_fields_to_products`
2. Add column in migration
3. Run migration: `php artisan migrate`
4. Add field to model's `$fillable` array
5. Update admin forms

---

## 🚢 Deployment Checklist

- [ ] Change admin credentials
- [ ] Set `APP_DEBUG=false` in `.env`
- [ ] Set `APP_ENV=production` in `.env`
- [ ] Update `.env` with production database
- [ ] Run `composer install --optimize-autoloader --no-dev`
- [ ] Run `npm run build`
- [ ] Run `php artisan migrate --force`
- [ ] Run `php artisan config:cache`
- [ ] Set up HTTPS/SSL
- [ ] Set up backups
- [ ] Configure payment gateway

---

## 📞 Need Help?

Common issues and solutions:

**Blank page after login?**
- Clear cache: `php artisan cache:clear`
- Check `.env` configuration

**Images not showing?**
- Run: `php artisan storage:link`
- Check storage permissions

**Database errors?**
- Run: `php artisan migrate:fresh --seed`

**Livewire not updating?**
- Clear cache and rebuild assets

---

## 🎉 You're All Set!

Start with:
1. Adding product categories
2. Uploading products
3. Customizing hero section
4. Testing checkout as customer

Happy selling! 🌶️
