# Vantage Finance House — Live Installation Guide

This package contains the full application source, Composer `vendor/` dependencies, and a MySQL database dump with demo data.

## Package contents

| Path | Purpose |
|------|---------|
| `database/sql/vantage_finance_house.sql` | Full database (schema + demo data + Vantage branding) |
| `.env.example` | Production environment template |
| `public/` | Web document root (point your domain here) |
| `vendor/` | PHP dependencies (already included) |

## Server requirements

- PHP **8.2+** with extensions: `mbstring`, `openssl`, `pdo_mysql`, `tokenizer`, `xml`, `ctype`, `json`, `bcmath`, `fileinfo`, `curl`
- MySQL **8.0+** or MariaDB **10.4+**
- Apache with `mod_rewrite` (or Nginx)
- Ability to set directory permissions

## Step 1 — Upload & extract

1. Upload `vantage-finance-house-*.zip` to your server.
2. Extract into your preferred path, for example:
   - `/home/USER/vantage` (VPS), or
   - `/home/USER/public_html/vantage` (cPanel)

## Step 2 — Point the domain to `public/`

**Important:** the website document root must be the `public/` folder (not the project root).

### Apache example (VPS)

```apache
<VirtualHost *:80>
    ServerName your-domain.com
    DocumentRoot /path/to/vantage/public

    <Directory /path/to/vantage/public>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
```

### cPanel / shared hosting

- Set the domain (or subdomain) document root to `.../vantage/public`
- Or place the project outside `public_html` and map the subdomain to `public/`

### Subdirectory install (example.com/vantage)

If the site runs under a subdirectory:

1. Set in `.env`:
   - `APP_URL=https://your-domain.com/vantage`
   - `ASSET_URL=https://your-domain.com/vantage`
   - `SESSION_PATH=/vantage`
2. Configure Apache Alias / rewrite so `/vantage` maps to `public/`.

## Step 3 — Create database & import SQL

In cPanel → MySQL Databases (or via SSH):

1. Create database, e.g. `vantage_finance`
2. Create a user and grant **ALL** privileges on that database
3. Import the dump:

```bash
mysql -u your_db_user -p vantage_finance < database/sql/vantage_finance_house.sql
```

Or use phpMyAdmin → Import → select `database/sql/vantage_finance_house.sql`.

> The dump creates tables and loads demo data. It does **not** create the MySQL database itself — create the empty database first.

## Step 4 — Configure `.env`

```bash
cd /path/to/vantage
cp .env.example .env
```

Edit `.env` and set at least:

```env
APP_URL=https://your-domain.com
ASSET_URL=https://your-domain.com
APP_DEBUG=false
APP_ENV=production

DB_DATABASE=vantage_finance
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password

SESSION_PATH=/
```

Generate the application key:

```bash
php artisan key:generate
```

## Step 5 — Permissions

```bash
chmod -R ug+rwx storage bootstrap/cache
# If the web user is www-data / nobody / USER:
chown -R USER:USER storage bootstrap/cache
```

## Step 6 — Optimize (recommended)

```bash
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

## Step 7 — Verify

Open:

- Landing: `https://your-domain.com/`
- Staff login: `https://your-domain.com/login`
- Internet Banking: `https://your-domain.com/portal/login`

### Demo logins (change after go-live)

Password for all demos: `Password@123`

| Role | Login |
|------|--------|
| System Admin | `admin@fundifinance.ng` |
| Managing Director | `md@fundifinance.ng` |
| Customer | Customer No. `FFC-C-000001` |

**Before production use:** change all demo passwords, update support email in **Settings**, and remove or disable demo accounts you do not need.

## Quick installer script (SSH)

If you have SSH access from the project root:

```bash
bash install.sh
```

The script will prompt for domain and database credentials, write `.env`, import SQL (optional), generate the key, and set storage permissions.

## Troubleshooting

| Issue | Fix |
|-------|-----|
| 500 error / blank blank | Check `storage/logs/laravel.log`; ensure `APP_KEY` is set; storage writable |
| CSS/JS 404 | `ASSET_URL` must match the live URL (including https / subdirectory) |
| Login session lost | Set `SESSION_PATH=/` for root domain (or `/subdir` for subdirectory) |
| Database connection refused | Verify `DB_*` host/user/password; some hosts use `localhost` not `127.0.0.1` |
| Mixed content | Use `https://` in both `APP_URL` and `ASSET_URL` |

## Support notes

- Brand assets: `public/images/brand/`
- Admin menus are editable under **Menus** after staff login
- Platform name is driven by Settings (`company_name` / `company_short_name`)
