# HotelPlus Deployment Guide

## Requirements

- PHP 8.2+
- MySQL 8+ (or MariaDB 10.4+)
- Extensions: bcmath, ctype, curl, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, zip
- Writable: `storage/`, `bootstrap/cache/`

## XAMPP (Windows)

1. Start Apache + MySQL from XAMPP Control Panel.
2. Place project at `C:\xampp\htdocs\hotelplus\reservation`.
3. Create database `hotelplus`.
4. Copy `.env.example` → `.env` and set:

```
APP_URL=http://localhost/hotelplus/reservation/public
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=hotelplus
DB_USERNAME=root
DB_PASSWORD=
```

5. Run:

```
C:\xampp\php\php.exe artisan key:generate
C:\xampp\php\php.exe artisan migrate --seed
echo installed > storage\installed
C:\xampp\php\php.exe artisan storage:link
```

6. Open `http://localhost/hotelplus/reservation/public/login`

Optional: set Apache Alias or vhost document root to the `public` folder.

## Web installer

1. Ensure `.env` exists with `APP_KEY` empty or set.
2. Remove `storage/installed`.
3. Visit `/install` and complete the wizard.
4. Wizard writes DB config, migrates, seeds roles, creates admin, locks installer.

## cPanel shared hosting

1. Upload files outside `public_html` when possible.
2. Point the domain/subdomain document root to the Laravel `public` directory.
3. If forced into a subdirectory, upload all files and ensure `public/index.php` paths resolve to the parent vendor/bootstrap folders.
4. Create MySQL DB + user in cPanel.
5. Set PHP version to 8.2+.
6. Cron job:

```
* * * * * /usr/bin/php /home/USER/path/to/artisan schedule:run >> /dev/null 2>&1
```

7. Recommended queue: database — run worker via cron every minute if long-running processes are disallowed:

```
* * * * * /usr/bin/php /home/USER/path/to/artisan queue:work --stop-when-empty
```

## Production checklist

- `APP_DEBUG=false`
- `APP_ENV=production`
- HTTPS enabled
- `php artisan config:cache`
- `php artisan route:cache`
- `php artisan view:cache`
- Schedule backups of MySQL + `storage/app`

## Upgrades

1. Backup DB and files.
2. Upload new release.
3. `composer install --no-dev -o`
4. `php artisan migrate --force`
5. `php artisan optimize`

## Default demo login (after seed)

- Email: `admin@hotelplus.test`
- Password: `password`
- Change immediately on production.
