# Infinity People HRM — notes for agents (branch `standalone`)

This branch is the **standalone, single-company edition** of Infinity People HRM (Laravel 13 + Filament 5, PHP 8.3).
`master` is the multi-tenant SaaS edition. Keep the differences below in mind before changing anything here.

## How the standalone edition differs from `master`

* **One organization.** `App\Support\Tenancy::current()` returns the single `Organization` row (cached per request;
  `Tenancy::runAs()` / `set()` / `flush()` still exist for jobs, commands and tests). Every table keeps its
  `organization_id` column and the `BelongsToOrganization` trait + `OrganizationScope` global scope, so services,
  policies (`TenantPolicy`, `ModuleTenantPolicy`) and tests work unchanged. Do **not** reintroduce Filament `->tenant()`.
* **No SaaS layer.** Removed: tenant registration / `EditTenantProfile`, the `/platform` panel and its resources,
  `SubscriptionInvoice` + `BillingService` + `billing:run`, `config/billing.php`, `Edition` enum, `EnsureSubscriptionActive`,
  `is_platform_admin`, organization `slug/plan/edition/status/trial_ends_at/max_employees` (migration
  `2026_11_09_000100_standalone_edition`). `Organization::hasModule()` always returns `true`; `App\Enums\Module` stays as a
  list for the API. Panel URLs have no tenant segment: `/app/employees`, not `/app/{slug}/employees`. Careers page is `/careers`.
* **Statutory tables** (`SsScheduleResource`, `TaxScheduleResource`) live in the admin panel under *Settings* and are
  guarded by `StatutoryPolicy` (Owner / Administrators). Company-level settings: `App\Filament\Pages\CompanyProfile`
  (name, logo served by `BrandingController`, approval rule, recruitment/careers); employer legal entities stay in
  `CompanyResource`.
* **No MFA.** `multiFactorAuthentication()` is gone from both panels, `User` no longer implements the Filament
  `HasAppAuthentication*` contracts, the API login takes email + password only, and the MFA columns were dropped.
  Password rules, throttling, CSRF, email verification, roles and policies are unchanged.
* **Installer.** `App\Services\Installer\Installer` is shared by `php artisan hrm:install` (`App\Console\Commands\InstallHrm`)
  and the web wizard (`routes/install.php`, `InstallController`, `resources/views/install/*`). The wizard is registered
  outside the `web` middleware group (no session / CSRF / APP_KEY needed before install). `EnsureInstalled` (global
  middleware) redirects to `/install` until `storage/app/installed.json` exists (or an organization row is found) and
  returns 404 for the wizard afterwards. HTTPS is forced only when `APP_URL` is https (or `FORCE_HTTPS=true`).

## Working on this branch

* `composer install`, then `php artisan test` (SQLite in memory, ~108 tests). `vendor/bin/pint --dirty` before committing.
* Local dev: `.env` with `APP_ENV=local` and a database, `php artisan migrate:fresh --seed` (demo company, users printed).
* Feature tests extend `Tests\TenantTestCase` (installs one organization "Acme Ltd" with an Owner and a payroll company).
* Node/Vite is not needed; Filament publishes its assets on `composer install` (`php artisan filament:assets`).
* Never push to a remote from an automated session; the customer receives this branch as a zip / git bundle.

<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>
