Actions
Last updated
Last updated
This is the official documentation of the forestadmin/laravel-forestadmin
v2+ and forestadmin/symfony-forestadmin
PHP agents.
Sooner or later, you will need to perform actions on your data that are specific to your business.
Moderating comments, generating invoices, logging into a customer’s account, or banning users are exactly the kind of important tasks to unlock to manage your day-to-day operations.
To create an Action, you will first need to declare it in your code for a specific collection. Here we declare a "Mark as Live" Action for the companies
collection.
The action behavior is implemented in the execute
parameter of BaseAction.
After declaring it, the Action will appear in the Smart Actions tab within your Collection Settings.
An Action is displayed in the UI only if:
it is set as "visible" (see screenshot below) AND
in non-development environments, the user's role must grant the "trigger" permission
You must make the Action visible there if you wish users to be able to see it in this Team.
Property | Usage | Description |
---|---|---|
scope
require
Single
, Global
or Bulk
. See here for more detail
execute
require
The callable called when the action is executed, with context
and result builder
as parameters. See context and result builder pages for more details.
description
optional
An optional description of the action. Default: null
submitButtonLabel
optional
A custom label for the submit button. Default: the action name