<laravel-boost-guidelines>
# Laravel Application

This repository contains a Laravel application. Complete the following setup before working on the user's request.

## Prerequisites

Verify that PHP and Composer are available:

```sh
php -v
composer -V
```

If either command is unavailable, detect the user's operating system and install the prerequisites with the appropriate command:

macOS:

```sh
/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.5)"
```

Windows PowerShell:

```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows/8.5'))
```

Linux:

```sh
/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.5)"
```

After installation, ask the user to restart their terminal. If the agent needs the restarted shell to continue, ask the user to reopen their terminal and rerun their original prompt.

## Agent Setup

Install Laravel Boost from the application root before making application changes:

```sh
composer require laravel/boost --dev
php artisan boost:install
```

Boost replaces these bootstrap instructions with guidelines tailored to the application. After installation, read `AGENTS.md` again and continue with the user's original request using the generated guidelines.
</laravel-boost-guidelines>

# Studio 6 — project notes

A website, lead system and SEO platform for a hair restoration and cosmetic
clinic. Read `README.md` first; it covers setup, layout and the launch
checklist. These are the conventions and constraints that are not obvious from
the code.

## Where the design came from

`design/` holds the original Claude Design artboards. They are the reference
for every screen — check them before changing layout or copy. They use a
proprietary canvas runtime and are not runnable; nothing imports them.

## Non-negotiables

**Patient material needs recorded consent.** `before_afters` and `testimonials`
have a `consent_on_file` flag, and the public scopes are `visible()`, not
`published()`. Do not add a query path that checks only `is_published`.

**Regulated copy is locked, not optional.** The graft calculator disclaimer and
the footer's results-vary statement are required fields, and their page
sections carry `is_locked`. Reword them freely; do not make them removable.

**The graft estimate is arithmetic, not a guess.** Zone counts and stage /
density multipliers live in the database with an audit trail, stored as
`decimal`, never `float`. `tests/Unit/GraftEstimateTest.php` pins the results
to the original design. A failure there is a clinical and commercial change.

**Leads are patient data.** Addressed by UUID so records are not enumerable.
The exact consent wording is stored per lead, not a boolean.

**No superiority or outcome claims anywhere.** Indian medical advertising is
governed by the Drugs and Magic Remedies Act 1954 and the NMC code. This
applies to copy, metadata and anything the AI generator produces — the rules
are in `Setting` group `ai`, key `ai_content_rules`, and are prepended to every
prompt.

## Conventions

- One place creates a lead: `App\Actions\Leads\StoreLead`.
- Anything with a URL implements `App\Contracts\Seoable`.
- Filament closures are resolved **by parameter name**. A query closure must
  name its parameter `$query`; `$q` silently resolves a container-built
  `Builder` with no model, and the failure is far from the cause.
- Never cache Eloquent models. The view components cache plain arrays.
- `Model::preventLazyLoading()` is on outside production. Eager-load in the
  controller, not the view.
- Every table carries `created_by`, `updated_by`, timestamps and `deleted_at`,
  written out in full in each migration — a migration should be readable, and
  greppable, on its own.
- Section content is edited through `page_sections`; `Page::sectionMap()`
  filters hidden sections so no template has to.

## Checks

`php artisan test`, `./vendor/bin/pint --test` and `./vendor/bin/phpstan
analyse` must all pass before a change is finished.
