Overview
Laravel Actions (lorisleiva/laravel-actions) organizes application business logic into reusable action classes that can be executed as controllers, jobs, listeners, or commands.
Geni natively understands the Laravel Actions pattern:
- Recognizes routes registered directly using an Action class name.
- Accurately resolves
asController()orhandle()as the execution method. - Extracts validation rules from an action’s
rules()method. - Documents automatic 403 Forbidden responses from an action’s
authorize()method. - Derives human-readable operation summaries from the Action class name.
Routing Resolution
In Laravel Actions, single-action routes are commonly defined as:routes/api.php
- It inspects the AST of the target class.
- It detects the
Lorisleiva\Actions\Concerns\AsActiontrait or method presence. - It selects
asController()(preferred) orhandle()(fallback) to inspect for controller behavior.
Validation Extraction
When an Action class defines arules() method or accepts an ActionRequest:
rules() method:
- Request body schema is generated with
nameandemailproperties. - Both fields are marked as
required. - String constraints and email formats are automatically applied.
Automatic 403 Response
When an action class defines anauthorize() method containing non-trivial logic (not merely return true;), Geni automatically documents a 403 Forbidden response:
Operation Summary Derivation
When no explicit@summary or #[Endpoint] title is present on an action method, Geni derives a clean, human-readable summary from the action class name:
CreateUser->"Create user"PublishArticleAction->"Publish article"ExportMonthlyReport->"Export monthly report"