# MASTER_TOOLS.md — Habib Cables ERP

Shared tools, packages, and helpers used across all components.

## Runtime & framework
- **PHP 8.2**, **Laravel 12** (bootstrapped via `bootstrap/app.php`, not the old `Kernel.php`).
- **MySQL** (SQLite supported for quick local/docker runs).
- **Laragon** = primary local stack (Windows). **Docker Compose** documented in `README.md`.

## Key backend packages (`composer.json`)
| Package | Use |
|---------|-----|
| `laravel/sanctum` | API & desktop token auth (`auth:sanctum`) |
| `spatie/laravel-permission` | RBAC — roles/permissions, `hasAnyRole`, gating |
| `spatie/laravel-activitylog` | Audit trail on every mutation (do not remove) |
| `yajra/laravel-datatables` | Server-side DataTables for all index grids |
| `barryvdh/laravel-dompdf` | PDF generation (GRNs, gate passes, reports) |
| `laravel/breeze` | Auth scaffolding (login/register/password) |
| `laravel/tinker` | REPL for inspection & token creation |

## Dev-only tooling (`require-dev`)
| Tool | Use |
|------|-----|
| `pestphp/pest` (+ laravel plugin) | Test runner — `php artisan test` |
| `laravel/dusk` | Browser/E2E tests |
| `laravel/pint` | PSR-12 formatter — `./vendor/bin/pint` |
| `laravel/pail` | Live log tailing — `php artisan pail` |
| `barryvdh/laravel-debugbar` | In-browser query/timeline profiler (dev) |
| `fakerphp/faker`, factories | Seed/test data |
| `mockery/mockery`, `nunomaduro/collision` | Test doubles & pretty errors |

## Frontend tooling (`package.json`)
- **Vite 7** (`laravel-vite-plugin`) — `npm run dev` / `npm run build`.
- **Tailwind CSS 3** (+ `@tailwindcss/forms`), **Alpine.js 3**, **axios**.
- `concurrently` powers `composer run dev` (server + queue + pail + vite together).

## Shared application helpers
- `app/helpers.php` — globally autoloaded helper functions (see `composer.json` `autoload.files`).
- `App\Helpers\RoleHelper` — role/permission convenience logic.
- Middleware aliases (registered in `bootstrap/app.php`):
  - `request.logging` → `RequestLoggingMiddleware`
  - `check.active.user` → `CheckActiveUser`
  - `check.role` → `CheckRole` (accepts one or more roles: `check.role:admin,manager`)
- `App\Providers\LoggingServiceProvider` + `LoggingController`/`LogViewerController` — structured
  request logging and an in-app log viewer.

## Observability
- `php artisan pail` for live logs; Debugbar in dev; activitylog for the who/what/when audit trail;
  the in-app log viewer for request logs.

## CI/CD
- Not yet configured in-repo. If added, wire `pint --test` + `php artisan test` as required checks
  and document the pipeline here.
