© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
Butterfly

Policy not applying on custom action

I have a custom filament class that extends filament table action. Its purpose is to update the record.
Everything works the way it's expected apart from the policies not being applied.
Here's an outline of the action:
class EditDiscountAction extends Action
{
    protected function setUp(): void
    {
        parent::setUp();

        $this->name('edit-discount');

        $this->label('Edit Discount');

        $this->icon('heroicon-o-pencil');

        $this->slideOver();

        $this->modalHeading('Edit Discount');

        $this->modalSubmitActionLabel('Edit Discount');

        $this->modalFooterActionsAlignment(Alignment::End);

        $this->successNotificationTitle('Discount updated successfully.');

        $this->failureNotificationTitle('Something went wrong.');

        $this->modalWidth(MaxWidth::Medium);

        $this->fillForm(function (Model $record): array {
            return $record->attributesToArray();
        });

        $this->action(function (Model $record, array $data) {
           // action implementation
    }

    public function getForm(Forms\Form $form): ?Forms\Form
    {
        return DiscountForm::getFormFields($form);
    }
}
class EditDiscountAction extends Action
{
    protected function setUp(): void
    {
        parent::setUp();

        $this->name('edit-discount');

        $this->label('Edit Discount');

        $this->icon('heroicon-o-pencil');

        $this->slideOver();

        $this->modalHeading('Edit Discount');

        $this->modalSubmitActionLabel('Edit Discount');

        $this->modalFooterActionsAlignment(Alignment::End);

        $this->successNotificationTitle('Discount updated successfully.');

        $this->failureNotificationTitle('Something went wrong.');

        $this->modalWidth(MaxWidth::Medium);

        $this->fillForm(function (Model $record): array {
            return $record->attributesToArray();
        });

        $this->action(function (Model $record, array $data) {
           // action implementation
    }

    public function getForm(Forms\Form $form): ?Forms\Form
    {
        return DiscountForm::getFormFields($form);
    }
}


I did browse through the source code and I found something regarding authorization in the CanBeHidden concern. However, I could not figure it out.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Custom Action Buttons Policy Conflict
FilamentFFilament / ❓┊help
2y ago
ActionGroup Action caching custom view
FilamentFFilament / ❓┊help
9mo ago
Custom Action on custom column.
FilamentFFilament / ❓┊help
9mo ago
Custom form filter is not applying
FilamentFFilament / ❓┊help
3y ago