Páginas · Laravilt
API Actions
Add custom endpoints to a resource's REST API.
Add custom endpoints to a resource API with ApiAction.
Basic Action
php
Action with Validation
php
Bulk Action
php
Collection Action (No Record)
php
ApiAction Methods
| Method | Description |
|---|---|
make(), slug(), label(), description() | Identity and docs |
icon(), color() | Display |
get(), post(), put(), patch(), delete(), method() | HTTP method |
requiresRecord() | Needs a record id in the URL |
bulk() | Operates on multiple records |
rules(), fields() | Validation and input fields |
requiresConfirmation() / confirmable() | Confirmation prompt |
before(), after() | Hooks around the action |
successMessage(), errorMessage() | Result messages |
hidden() | Hide the action |
action() | Callback receiving ($record, $request) |