# Quick Start Guide - MiMSMS Voter System

## For Developers (Local Setup)

### Prerequisites
- PHP 8.1 or higher
- Composer
- MySQL/MariaDB

### Installation

```bash
# 1. Clone or download the project
git clone <repository-url> mimsms_laravel
cd mimsms_laravel

# 2. Install dependencies
composer install

# 3. Create environment file
cp .env.example .env

# 4. Generate application key
php artisan key:generate

# 5. Configure database in .env
# Edit DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD

# 6. Run migrations
php artisan migrate

# 7. Start development server
php artisan serve

# 8. Visit http://localhost:8000
```

## For cPanel Hosting

### Quick Steps

1. **Download all files** from the project directory
2. **Upload to cPanel** public_html folder
3. **Create MySQL database** via cPanel
4. **Edit .env file** with your database credentials
5. **Run setup script**:
   ```bash
   chmod +x setup.sh
   ./setup.sh
   ```
6. **Create admin user** via SSH:
   ```bash
   php artisan tinker
   # Then run:
   $user = new App\Models\User();
   $user->name = 'Admin';
   $user->email = 'admin@yourdomain.com';
   $user->password = bcrypt('password');
   $user->role = 'admin';
   $user->save();
   exit
   ```

See [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md) for detailed instructions.

## Default Login

After setup, you can log in with the admin account you created.

## First Steps

1. **Import Voter Data**:
   - Log in as admin
   - Go to Admin Dashboard
   - Click "Import Voter Data"
   - Upload your Excel file

2. **Test the System**:
   - Go to Home page
   - Select District → Thana → Electoral Area
   - View voter data
   - Create a test order

3. **Configure WHMCS** (if using):
   - Update WHMCS credentials in .env
   - Test order creation

## File Structure Overview

```
mimsms_laravel/
├── app/              # Application code (Models, Controllers, Services)
├── database/         # Migrations and seeders
├── resources/views/  # Blade templates
├── routes/           # URL routes
├── config/           # Configuration files
├── storage/          # Logs and cache
├── public/           # Web-accessible files
└── .env             # Environment configuration
```

## Troubleshooting

### Database Connection Error
- Verify database credentials in .env
- Check MySQL is running
- Ensure user has proper privileges

### Permission Errors
```bash
chmod -R 777 storage
chmod -R 777 bootstrap/cache
```

### Clear Cache
```bash
php artisan cache:clear
php artisan config:clear
php artisan view:clear
```

## Support

- See README.md for full documentation
- See DEPLOYMENT_GUIDE.md for cPanel setup
- Check Laravel docs: https://laravel.com/docs

## Next Steps

1. Customize branding colors if needed (in resources/views/layouts/app.blade.php)
2. Set up email notifications
3. Configure WHMCS API integration
4. Import your voter data
5. Test all features before going live
