Rekhu Assistant for a Laravel API with its own front end
rekhu/assistant-laravel 0.4.0 follows your own permission rules and opens the pages of your Nuxt, Next or mobile front end.
Many Laravel apps are an API with a front end of their own: a Nuxt or Next dashboard, a mobile app. From 0.4.0, Rekhu Assistant fits that setup without workarounds.
-
Your own permission rule. Apps that check rights with Laratrust, Spatie or a permission per route name tell the assistant in one line, so a user is only offered what they may do:
RekhuAssistant::authorizeUsing(fn ($user, $route) => $user->isAbleTo($route->getName()));Every action still runs through the route's own middleware, as if the user clicked it in the app.
-
Your front end's pages. List the pages of your Nuxt or Next app in the config, or give them from code as the user may open them. The assistant offers a button that opens the page in your front end, with the right ids filled in.
-
The chat under
api/. If your app exempts onlyapi/*from CSRF, setREKHU_ASSISTANT_PATH=api/rekhu/assistantand the chat works from your front end's domain with the same token your app already uses.
Update with composer update rekhu/assistant-laravel. The README has the full setup for an API with Nuxt, Next or a mobile app.