Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

auroralabs's avatar

Policy being ignored with custom button on ListPage

In Filament 3 I have a ReceiptPolicy that restricts a Staff user from adding a receipt record. The policy works apart from the fact that the Staff account stills has the ability to add receipts as the button is still available.

On the ListReceipt page there is an action that is used to change the title of the Add Receipt button slightly and this seems to be the offending item. When this is removed and the default button state of Add Receipt is back the Policy activates and removes the button from the Staff account. When the function is reintroduced to the page the Policy is ignored.

Is there a reason why this would happen as it seems bizarre that a simple label function can ignore a policy that is in place.

ReceiptPolicy

ListReceipts.php

     protected function getHeaderActions(): array
    {
        return [
            Actions\CreateAction::make()
            ->label('Create New Receipt'),
        ];
    }
0 likes
0 replies

Please or to participate in this conversation.