How can I get record when calling a custom Action?

Basically, I want to create a ZIP file of all the elements that are in the repeater, But how can I get the record in the Action?
<?php

namespace App\Actions;
use Filament\Actions\Action;
use Illuminate\Database\Eloquent\Model;

class ZipAction extends Action{

    public static function getDefaultName(): ?string
    {
        return 'Zip Action';
    }

    protected function setUp(): void
    {
        parent::setUp();

        // $this->label(__('filament-actions::delete.single.label'));
        $this->label("Zip Action");

        // $this->modalHeading(fn (): string => __('filament-actions::delete.single.modal.heading', ['label' => $this->getRecordTitle()]));

        // $this->modalSubmitActionLabel(__('filament-actions::delete.single.modal.actions.delete.label'));

        // $this->successNotificationTitle(__('filament-actions::delete.single.notifications.deleted.title'));

        $this->color('info');

        $this->groupedIcon('heroicon-m-inbox-arrow-down');

        // $this->requiresConfirmation();

        $this->modalIcon('heroicon-o-inbox-arrow-down');

        $this->keyBindings(['mod+d']);

        $this->hidden(static function (Model $record): bool {
            if (! method_exists($record, 'trashed')) {
                return false;
            }

            return $record->trashed();
        });

        $this->action(function (): void {
            $result = $this->process(static fn (Model $record) => $record);
            dd($result);

            // $this->success();
        });
    }
}

<?php

namespace App\Filament\Resources\TestResource\Pages;

//...

class EditTest extends EditRecord
{
    protected static string $resource = TestResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\DeleteAction::make(),
            ZipAction::make()
        ];
    }
}
Was this page helpful?