React
class React extends Action (View source)
Properties
$bulk | Whether the action can be applied to multiple models at once. |
from Action | |
$confirm | Whether the action requires confirmation or user input before it is run. |
from Action | |
$destructive | Whether the action is destructive, and should have a red appearance. |
from Action |
Methods
Whether the action should be listed in a menu for the given models.
The label to be displayed in the action button.
The name of an icon to be displayed in the action button.
Render the action button.
Render the content of the action button.
Confirmation message or view to prompt the user with before the action is run.
Label to be displayed on the confirmation button.
Run the action on the given models.
Details
bool
appliesTo(Model $model)
Whether the action can logically be applied to the given model.
bool
authorize(User|null $user, Model $model)
Whether a user is allowed to apply the action to the given model.
By default, the action can be applied if the user is logged-in.
bool
shouldRender(Collection $models, string $context = null)
Whether the action should be listed in a menu for the given models.
string
label(Collection $models)
The label to be displayed in the action button.
string|null
icon(Collection $models)
The name of an icon to be displayed in the action button.
in
Action at line 81
array
attributes(Collection $models)
Any extra attributes for the action button.
in
Action at line 89
HtmlString
render(Collection $models, array $attributes, bool $tooltip = false)
Render the action button.
protected HtmlString
renderContent(Collection $models, bool $tooltip = false)
Render the content of the action button.
View
confirm(Collection $models)
Confirmation message or view to prompt the user with before the action is run.
string
confirmButton(Collection $models)
Label to be displayed on the confirmation button.
run(Collection $models)
Run the action on the given models.
You can optionally return a response, such as a redirect or a file download. If you don't return anything, Waterhole will keep the user on the current page.
array
stream(Model $model)
Stream partial updates to the page via Turbo Streams.
Return an array of streamRemoved
method if the action is
destructive, and the streamUpdated
method if it isn't.