# 🔐 Admin Setup & Credentials

## Quick Setup (One Command)

After installing Spatie Permission, run this single command:

```bash
php artisan db:seed --class=AdminSeeder
```

This automatically creates 3 users with roles and permissions.

---

## 🎯 Admin Credentials

### Primary Admin
```
Email:    admin@tourism.com
Password: Admin@123456
```

### Demo Admin
```
Email:    demo@example.com
Password: Demo@123456
```

### Test Customer
```
Email:    customer@example.com
Password: Customer@123456
```

---

## 📋 Complete Setup Steps

### Step 1: Install Spatie Permission
```bash
cd e:\project\tourism
composer require spatie/laravel-permission
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
```

### Step 2: Run Migrations (Both)
```bash
# Permission tables migration
php artisan migrate

# Your offline payment migration
php artisan migrate
```

### Step 3: Create Admin (One Command)
```bash
php artisan db:seed --class=AdminSeeder
```

This will output:
```
✓ Admin users created successfully!

Admin Credentials:
─────────────────────────────────
Email: admin@tourism.com
Password: Admin@123456

Demo Admin:
─────────────────────────────────
Email: demo@example.com
Password: Demo@123456

Test Customer:
─────────────────────────────────
Email: customer@example.com
Password: Customer@123456
```

### Step 4: Clear Cache
```bash
php artisan cache:clear
php artisan config:clear
```

---

## ✅ Verify Setup

Visit in your browser:
1. `/login` - Try admin@tourism.com / Admin@123456
2. `/admin/dashboard` - Should see admin panel
3. `/admin/offline-payments` - Should see offline payments section

---

## 🔐 What Gets Created

**Roles**
- `admin` - Full access
- `customer` - Limited access

**Permissions** (10 total)
- view-payments
- manage-payments
- view-bookings
- manage-bookings
- view-packages
- manage-packages
- view-users
- manage-users
- view-settings
- manage-settings

**Users** (3 total)
- Admin User (admin@tourism.com)
- Demo Admin (demo@example.com)
- Sample Customer (customer@example.com)

---

## 🛡️ Password Requirements

All default passwords follow security best practices:
- Minimum 8 characters
- Mix of uppercase, lowercase, numbers
- Format: `[Role]@123456`

**Change passwords after first login!**

---

## 🔄 Reset Everything

If you need to reset:

```bash
# Drop and recreate database
php artisan migrate:refresh

# Run seeder again
php artisan db:seed --class=AdminSeeder
```

---

## 📞 Login Tips

**Admin Panel URL**: `/admin/dashboard`

**If login fails**:
1. Clear cache: `php artisan cache:clear`
2. Verify user exists: `php artisan tinker` then `User::where('email', 'admin@tourism.com')->first()`
3. Check migration ran: `php artisan migrate:status`

---

## 💾 View Seeder Code

Location: `database/seeders/AdminSeeder.php`

This file contains:
- Role creation
- Permission setup
- User creation with roles assigned
- Output messages

Edit this file to change default usernames, emails, or permissions.

---

## ✨ Features Included

✅ Multiple admin accounts
✅ Role-based access control
✅ Permission system
✅ Test customer account
✅ All permissions auto-assigned
✅ Email verification enabled
✅ Timestamps recorded

---

**Status**: ✅ Ready to Use
**Date**: May 26, 2026
