Skip to main content
Laravel Actions (lorisleiva/laravel-actions) organizes application business logic into reusable action classes that can run as controllers, jobs, listeners, or commands. Geni natively understands this pattern — it detects Action classes registered as routes, resolves the correct execution method, extracts validation rules, documents authorization responses, and derives human-readable operation summaries, all without booting your application.

Routing Resolution

In Laravel Actions, single-action routes are commonly registered by passing the action class name directly to the router:
routes/api.php
When Geni encounters these routes, it:
1

Inspects the AST of the target class

Geni traverses the source file for the registered Action class.
2

Detects the AsAction trait or method presence

It checks for the Lorisleiva\Actions\Concerns\AsAction trait or equivalent method signatures.
3

Selects the execution method

It prefers asController() as the controller entry point, falling back to handle() if asController() is not defined.

Validation Extraction

When an Action class defines a rules() method or accepts an ActionRequest, Geni statically parses the returned rules array exactly as it does for dedicated Form Requests:
From the rules() method above, Geni produces a request body schema with:
  • name: type: string, maxLength: 255, marked required.
  • email: type: string, format: email, marked required.

Automatic 403 Response

When an action class defines an authorize() method containing non-trivial logic (i.e., not simply return true;), Geni automatically documents a 403 Forbidden response alongside the standard success response:
You do not need to annotate this manually — Geni detects the presence of real authorization logic through static analysis.

Operation Summary Derivation

When no explicit @summary annotation or #[Endpoint] title is present on an action method, Geni derives a clean, human-readable summary by splitting the action class name on word boundaries and removing common suffixes like Action: