class MarkAsAnswer 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

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.

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.

array
attributes(Collection $models)

Any extra attributes for the action button.

from  Action
HtmlString
render(Collection $models, array $attributes, bool $tooltip = false)

Render the action button.

from  Action
HtmlString
renderContent(Collection $models, bool $tooltip = false)

Render the content of the action button.

from  Action
View
confirm(Collection $models)

Confirmation message or view to prompt the user with before the action is run.

from  Action
string
confirmButton(Collection $models)

Label to be displayed on the confirmation button.

from  Action
run(Collection $models)

Run the action on the given models.

array
stream(Model $model)

Stream partial updates to the page via Turbo Streams.

Details

bool appliesTo(Model $model)

Whether the action can logically be applied to the given model.

Parameters

Model $model

Return Value

bool

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.

Parameters

User|null $user
Model $model

Return Value

bool

bool shouldRender(Collection $models, string $context = null)

Whether the action should be listed in a menu for the given models.

Parameters

Collection $models
string $context

Return Value

bool

string label(Collection $models)

The label to be displayed in the action button.

Parameters

Collection $models

Return Value

string

string|null icon(Collection $models)

The name of an icon to be displayed in the action button.

Parameters

Collection $models

Return Value

string|null

array attributes(Collection $models)

Any extra attributes for the action button.

Parameters

Collection $models

Return Value

array

HtmlString render(Collection $models, array $attributes, bool $tooltip = false)

Render the action button.

Parameters

Collection $models
array $attributes
bool $tooltip

Return Value

HtmlString

protected HtmlString renderContent(Collection $models, bool $tooltip = false)

Render the content of the action button.

Parameters

Collection $models
bool $tooltip

Return Value

HtmlString

View confirm(Collection $models)

Confirmation message or view to prompt the user with before the action is run.

Parameters

Collection $models

Return Value

View

string confirmButton(Collection $models)

Label to be displayed on the confirmation button.

Parameters

Collection $models

Return Value

string

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.

Parameters

Collection $models

array stream(Model $model)

Stream partial updates to the page via Turbo Streams.

Return an array of elements. The default implementation gets streams from the model's streamRemoved method if the action is destructive, and the streamUpdated method if it isn't.

Parameters

Model $model

Return Value

array