© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Pablo Torres

Conditionally hide action button.

I have created an Action.
Everything is working fine with the code below. When the action button is used the modal appears, and after confirming 'marked_ready_at' gets the current date/time.
    protected function getActions(): array
    {
        return [
            Action::make('Mark Ready')
                ->action(function (array $data): void {
                    $this->record->marked_ready_at = now();
                    $this->record->save();
                    $this->refreshFormData([
                        'marked_ready_at',
                    ]);
                })
                ->requiresConfirmation()
                ->modalHeading('Booking Ready')
                ->modalSubheading('Are you sure.')
                ->modalButton('Yes, it\'s ready'),
            Actions\ViewAction::make(),
            Actions\DeleteAction::make(),
        ];
    }
    protected function getActions(): array
    {
        return [
            Action::make('Mark Ready')
                ->action(function (array $data): void {
                    $this->record->marked_ready_at = now();
                    $this->record->save();
                    $this->refreshFormData([
                        'marked_ready_at',
                    ]);
                })
                ->requiresConfirmation()
                ->modalHeading('Booking Ready')
                ->modalSubheading('Are you sure.')
                ->modalButton('Yes, it\'s ready'),
            Actions\ViewAction::make(),
            Actions\DeleteAction::make(),
        ];
    }

I want to hide or disable the action button "Mark Ready" when "marked_ready_at" has a date/time.
Any suggestion on how I can achieve this?
Thanks.
Solution
use
->hidden(fn () => (bool) $this->record->marked_ready_at)
->hidden(fn () => (bool) $this->record->marked_ready_at)
Jump to solution
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

Conditionally hide attach action
FilamentFFilament / ❓┊help
3y ago
Conditionally hide form in modal action
FilamentFFilament / ❓┊help
3y ago
How to hide this button - conditionally
FilamentFFilament / ❓┊help
6mo ago
Hide default action buttons
FilamentFFilament / ❓┊help
2y ago