# Multi-Domain Support Portal (Laravel 13)

Laravel frontend + CMS that sits **alongside** the existing HESK app in `c:\wamp64\www\support`.

- One codebase, many domains
- Per-domain **Header / Footer / Content** managed from admin
- Ticket categories + submit via existing `/support/api` endpoints

## Requirements

- PHP **8.2+** (WAMP has 8.3 — use that for this project; HESK can keep 7.4)
- Composer
- Existing HESK API at `http://localhost/support/api`

## Setup (WAMP)

```powershell
cd C:\wamp64\www\support-portal
$env:Path = "C:\wamp64\bin\php\php8.3.28;" + $env:Path

# .env already has APP_KEY; set API URL if needed
# SUPPORT_API_URL=http://localhost/support/api

php artisan migrate --seed
php artisan storage:link
```

Point Apache/Nginx (or WAMP virtual host) document root to:

```
C:\wamp64\www\support-portal\public
```

Or for quick local test:

```powershell
php artisan serve --host=127.0.0.1 --port=8000
```

Then open:

- Site: http://127.0.0.1:8000
- Admin: http://127.0.0.1:8000/admin/login

### Default admin

| Field | Value |
|-------|-------|
| Email | `admin@support.local` |
| Password | `password` |

Change this immediately after first login.

## Multi-domain

Admin → **Domains**:

| Field | Meaning |
|-------|---------|
| Host | Exact hostname (`support.textileup.org.in`) |
| Form slug | HESK project slug used by API (`/forms/{slug}`) |
| Header | Logo, Hindi/English org name, system name, breadcrumb |
| Footer | Copyright, contact, links, optional HTML |
| Content | Home heading, card labels, categories heading |
| Default | Used when host is `localhost` / unmatched |

### Local preview of another domain

```
http://127.0.0.1:8000/?_domain=textile
```

## API integration

`App\Services\SupportApiService` calls:

| Method | Endpoint |
|--------|----------|
| GET | `/forms/{slug}` — categories + custom fields |
| POST | `/forms/{slug}/tickets` — submit ticket |

Configured in `.env`:

```
SUPPORT_API_URL=http://localhost/support/api
SUPPORT_API_KEY=   # optional, for admin API ops
```

## Public routes

| Path | Page |
|------|------|
| `/` | Home (Submit / View cards) |
| `/tickets/new` | Category picker (from API) |
| `/tickets/new/{category}` | Ticket form |
| `/tickets/view` | Lookup by tracking ID |

## Folder note

| Path | Role |
|------|------|
| `C:\wamp64\www\support` | Existing HESK + API (unchanged) |
| `C:\wamp64\www\support-portal` | This Laravel multi-domain portal |
