Add Table to BulkAction
Hey. Can i add a table to this bulk action? I've tried using $this->table but i'm not sure how it works, could someone nudge me in the right direction?
<?php
namespace App\Filament\Tables\Actions;
class JoinProductsBulkAction extends BulkAction
{
use CanCustomizeProcess;
public static function getDefaultName(): ?string
{
return 'delete';
}
protected function setUp(): void
{
parent::setUp();
$this->label(__('Join multiple'));
$this->modalHeading(fn (): string => __('filament-actions::delete.multiple.modal.heading', ['label' => $this->getPluralModelLabel()]));
$this->modalSubmitActionLabel(__('filament-actions::delete.multiple.modal.actions.delete.label'));
$this->successNotificationTitle(__('filament-actions::delete.multiple.notifications.deleted.title'));
$this->color('danger');
$this->icon(FilamentIcon::resolve('actions::delete-action') ?? 'heroicon-m-trash');
// $this->requiresConfirmation();
$this->modalIcon(FilamentIcon::resolve('actions::delete-action.modal') ?? 'heroicon-o-trash');
$this->form([
TextInput::make('New name')
->required(),
]);
$this->action(function (): void {
$this->process(static fn (Collection $records) => $records->each(fn (Model $record) => $record->delete()));
$this->success();
});
$this->slideOver();
$this->closeModalByClickingAway(false);
$this->deselectRecordsAfterCompletion();
}
}
<?php
namespace App\Filament\Tables\Actions;
class JoinProductsBulkAction extends BulkAction
{
use CanCustomizeProcess;
public static function getDefaultName(): ?string
{
return 'delete';
}
protected function setUp(): void
{
parent::setUp();
$this->label(__('Join multiple'));
$this->modalHeading(fn (): string => __('filament-actions::delete.multiple.modal.heading', ['label' => $this->getPluralModelLabel()]));
$this->modalSubmitActionLabel(__('filament-actions::delete.multiple.modal.actions.delete.label'));
$this->successNotificationTitle(__('filament-actions::delete.multiple.notifications.deleted.title'));
$this->color('danger');
$this->icon(FilamentIcon::resolve('actions::delete-action') ?? 'heroicon-m-trash');
// $this->requiresConfirmation();
$this->modalIcon(FilamentIcon::resolve('actions::delete-action.modal') ?? 'heroicon-o-trash');
$this->form([
TextInput::make('New name')
->required(),
]);
$this->action(function (): void {
$this->process(static fn (Collection $records) => $records->each(fn (Model $record) => $record->delete()));
$this->success();
});
$this->slideOver();
$this->closeModalByClickingAway(false);
$this->deselectRecordsAfterCompletion();
}
}
1 Reply
Not following you. What do you mean by add a table to the action?