# Installing Vesta for a hotel

One installation serves one property. Every customer gets their own cPanel
account, their own database and their own copy of this application.

Budget about 45 minutes, plus however long the customer takes to send their
room list.

---

## Before install day — ask the customer for

- **Hotel name** as guests know it, and the **registered business name** for documents
- **TIN**, if they are registered (blank is fine — it can be filled in later in Settings)
- **Address, city, province, postal code, front-desk phone, reservations email, website**
- **Prefix** for the sales-document series (default `OR`)
- **Who the first administrator is** — full name and the email they will sign in with
- **Their room list** — send them `docs/room-import-template.csv` and ask them to fill it in

Required CSV columns: `no`, `floor`, `type`, `rate`. Optional: `name`, `wing`,
`beds`, `max_pax`, `sqm`. A blank `name` is fine.

---

## 1. Provision

1. Create the cPanel account and point the domain at it.
2. Create an empty MySQL database and a user with full rights on it.
3. Issue the SSL certificate (AutoSSL) and confirm `https://` resolves.

## 2. Deploy the code

```bash
cd ~
git clone <repo> hotel && cd hotel
composer install --no-dev --optimize-autoloader
cp .env.example .env
php artisan key:generate
```

Point the docroot symlink at `~/hotel/public`.

## 3. Configure `.env`

Set at minimum:

```
APP_NAME="<Hotel Name>"
APP_ENV=production
APP_DEBUG=false
APP_URL=https://<their domain>

DB_DATABASE=... DB_USERNAME=... DB_PASSWORD=...

MAIL_MAILER=smtp        # NOT log — guests get booking confirmations
MAIL_HOST=...  MAIL_USERNAME=...  MAIL_PASSWORD=...
MAIL_FROM_ADDRESS="no-reply@<their domain>"

SESSION_SECURE_COOKIE=true
```

## 4. Migrate and install

```bash
php artisan migrate --force
php artisan install:hotel --rooms=rooms.csv
```

`install:hotel` prompts for everything from the checklist above, then:

- seeds **roles and permissions only** — no sample rooms, guests, reservations or POS products
- writes **the hotel's own identity** into Settings, so folios, receipts and reports carry their name and TIN
- creates **one super-admin** with a generated password, **printed once**
- imports the room CSV (all-or-nothing: a bad row aborts the whole import)
- prints a **go-live checklist**

It refuses to run if the database already holds reservations, guests or POS
transactions — that guard is what stops a careless re-run from rewriting a
working property's identity. `--force` overrides it deliberately.

**Never run `php artisan db:seed` on a customer install.** That is the demo
seeder (`DemoSeeder`): it stamps Parkview Hotel Corporation and TIN
123-456-789-000 onto their receipts, ships five documented staff passwords, and
loads 63 Parkview rooms, 72 reservations and a stranger's guest list.

The seeders now refuse to run once a property has been installed, so a mistyped
command stops with an explanation rather than wiping a working hotel. Do not
treat that guard as permission to be casual — it keys off the property name in
Settings, and it cannot save you before `install:hotel` has been run.

## 5. Finish

```bash
php artisan storage:link
php artisan config:cache && php artisan route:cache && php artisan view:cache
mkdir -p storage/app/backups
```

Add the scheduler to cron — **without this there are no nightly backups**, and
the Backups page still looks healthy:

```
* * * * * cd ~/hotel && php artisan schedule:run >> /dev/null 2>&1
```

## 6. Hand over

1. Sign in as the administrator and change the password with the owner present.
2. Create their staff accounts under **Staff & Roles**, one per person, by role.
3. Check **Property Settings** with them — name, TIN, VAT rate, check-in/out times.
4. Upload their logo and set up the public website content.
5. Run **Backups** once manually so they have seen it work.
6. Walk them through their own hotel by role, per the plan they bought.

## Re-installing or renaming

Changing the property name, TIN or document prefix later is a **Settings** edit,
not a re-install. Only re-run `install:hotel --force` on a system you intend to
wipe clean of its identity.
