# petav3

PropertyLab's property platform — a clean rebuild of petav2 (Laravel 6 → 10,
Blade/jQuery → Inertia + Vue 3). Two surfaces:

- **Manage** — internal admin portal (leads, events, memberships, calls, WhatsApp, Zoom).
- **Main** — the customer-facing **InvestHink investor portal**: Wealth Planning,
  Analyze Property, Property Concierge, AI Conversations, Learn.

## Stack

Laravel 10 · PHP 8.4 · MySQL · Inertia.js · Vue 3 · Tailwind CSS v4 · Vite ·
spatie/laravel-permission (RBAC) · PHPUnit + Vitest.

## Prerequisites

- PHP **8.4+** with `ext-zip`, `ext-pdo_mysql`
- MySQL 8 (locally: Laragon)
- Node 18+ / npm
- Composer

## Local setup

```bash
git clone <repo> && cd petav3
composer install
cp .env.example .env            # then set DB_* (+ REFERENCE_DB_* — see DB note below)
php artisan key:generate
php artisan migrate:fresh --seed # build all tables + baseline data (roles, demo users)
php artisan db:seed --class='\MarketDataSeeder' # optional local Analyze fixture; no external DB
php artisan storage:link
npm install
```

Run the app (two terminals):

```bash
npm run dev                      # Vite dev server (HMR)
php artisan serve --port=8001    # app at http://127.0.0.1:8001
```

Sign in with a seeded demo account (password = email), e.g.
`member@propertylab.test` for the investor portal.

> **Database is more than `migrate:fresh`.** Full market datasets are loaded
> through governed imports, while local Analyze development uses the explicit
> deterministic `MarketDataSeeder`. Read
> **[docs/DEPLOY.md](docs/DEPLOY.md)** before expecting the Analyze Property or
> Learn features to show data — it covers migrations, local fixtures,
> real-source imports and live deploy.

## Testing

```bash
php artisan test                 # or: vendor/bin/phpunit
npm run test                     # Vitest (frontend math modules)
vendor/bin/pint                  # PSR-12 lint (run before every PR)
```

Tests use an isolated `petav3_testing` database (see `phpunit.xml`).

## Project layout

```
app/Http/Controllers/{Manage,Main}/  — thin controllers, return Inertia::render
src/<Module>/                         — models, Repositories, Services, Facades
resources/js/Pages/{Context}/<Module>/ — Vue pages
resources/js/Components/               — shared UI (DataTable, Modal, …)
database/migrations | seeds            — schema + seeders
docs/                                  — DEPLOY, roadmap, module handbook
```

## Conventions

All coding rules live in **[GUIDELINES.md](GUIDELINES.md)** (mandatory): Repository
pattern + Form Requests, Diver base models (`uuid` + blame + soft deletes), no
schema-level foreign keys, Inertia (no Blade UI / no REST-for-pages), Tailwind v4
utilities only. When building a module, follow `docs/modules_handbook/`.

## Branching

Feature branch off `master` (`<name>-<feature>`); never commit to `master`.
Small atomic commits; run `vendor/bin/pint` + tests before a PR; **squash-merge**.
