Files
laravel-manager-packagist/resources/ai/INTEGRATION.md
T

23 lines
1.7 KiB
Markdown

# Integrating iriks-it/laravel-manager (guide for AI agents)
Goal: the manager runs in this Laravel app and `php artisan manager:doctor` is green. Do the steps in order and
never edit files inside `vendor/`.
1. `composer require iriks-it/laravel-manager`
2. Pick the modules. `users` and `media` are on; `pages`, `posts` default on; `reviews`, `audit`, `statistics` default off
(audit and statistics store visitor data: only switch them on when the owner says so).
3. `php artisan manager:install --modules=users,media,posts --user-model="App\Models\User"`
(writes `MANAGER_*` to `.env`, publishes `config/manager.php`, runs the doctor). Add `--path=admin` to move the URL.
4. Add the trait to the user model: `use \IriksIT\Manager\Concerns\HasManagerAccess;`. Never put `is_super_admin` in `$fillable`.
5. `php artisan migrate` (a new process, so it sees the switches you wrote in step 3).
6. Create the first super admin: `php artisan manager:create-user --name="..." --email="..." --password="<12+ chars>"`.
7. Run `php artisan manager:doctor --json`. Every check must be `ok` or an understood `warn`; each `fail`/`warn` has a `fix`.
Repeat until `"ok": true`.
Facts that matter:
- The manager lives at `/manager` (`MANAGER_PATH`) behind `web` + `auth` (`manager.middleware`); the app needs a route named `login`.
- Anything that is off has no routes, tables or permissions. A module that needs another one fails at boot when that one is off.
- Answers are JSON. Do not add site-specific code to the package: a site's own part is its own module class (`Contracts\Module`,
extend `Modules\BaseModule`, add it to `manager.available`).
- Behind a proxy set trusted proxies before switching `audit` on.