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

2.8 KiB

Integrating iriks-it/laravel-manager (guide for AI agents)

Goal: the manager runs in this Laravel app and php artisan manager:doctor --json says "ok": true. Do the steps in order and never edit files inside vendor/.

  1. composer require iriks-it/laravel-manager (A version that is not on Packagist yet: first composer config repositories.manager --json '{"type":"path","url":"/path/to/laravel-manager","options":{"symlink":false}}', then require @dev.)
  2. Pick the modules. users and media are on; pages and posts are on by default; reviews, audit and statistics are 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" It writes the MANAGER_* switches to .env and publishes config/manager.php. Add --path=admin to move the URL. It does not run the check itself (this process still has the old config): that is step 7.
  4. Add the trait to the user model: use \IriksIT\Manager\Concerns\HasManagerAccess;. Never put is_super_admin in $fillable.
  5. php artisan config:clear && php artisan migrate && php artisan storage:link (a new process, so it sees the switches of step 3).
  6. Create the first super admin: php artisan manager:create-user --name="..." --email="..." --password="<12+ chars>".
  7. php artisan manager:doctor --json. Every check must be ok or an understood warn; each fail and warn has a fix. Repeat until "ok": true.

Facts that matter:

  • The screens are part of the package (MANAGER_UI=package, the default): open /manager in a browser. The app does not need a login of its own: when it has no route named login, the manager's own login at /manager/login is used. With MANAGER_UI=none there are only the JSON routes.
  • A browser address gets the screens, a request with Accept: application/json gets the data. To call the JSON routes from a script: GET /manager/login once for the XSRF-TOKEN cookie, then POST /manager/login with header X-XSRF-TOKEN (the cookie value, URL-decoded), Accept: application/json and body {"email": "...", "password": "..."}; the answer is {"redirect": "/manager"}.
  • The look: MANAGER_THEME=dark|light or your own (php artisan manager:make-theme acme --brand=#e4002b --name="Acme" --logo=/img/logo.svg, then MANAGER_THEME=acme). Each account can pick its own in its profile (MANAGER_USER_THEMES=false stops that).
  • Anything that is off has no routes, tables or permissions. A module that needs another one fails at boot when that one is off.
  • 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.