Skip to content

Actions

Action, modals, redirects, and table header/row action groups.

Actions are buttons that run closures, open modals, or redirect. Base class: Streams\Ui\Builders\Actions\Action.

Basic action

use Streams\Ui\Builders\Actions\Action;

Action::make('publish')
    ->label('Publish')
    ->icon('heroicon-o-check')
    ->action(function ($entry) {
        $entry->published = true;
        $entry->save();
    });

Table actions

Register on the table builder:

->actions([
    Action::make('edit')->url(fn ($entry) => PostResource::getUrl('edit', ['entry' => $entry])),
])
->headerActions([
    Action::make('create')->url(fn () => PostResource::getUrl('create')),
])

Modals and forms

Actions support modal forms via ->form([...]) and redirect via ->redirect() concerns on MountableAction.

Action groups

ActionGroup and table-specific action classes organize related actions in dropdown menus.

Related