© 2026 Hedgehog Software, LLC

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

Open a filament modal in beforeCreate() lifecycle hook

Is there a way to open a filament modal on a Create Resource, panel, page
Like

public function beforeCreate()
{
   if($foo) {
      //open modal
      $this-halt();
   }
}
public function beforeCreate()
{
   if($foo) {
      //open modal
      $this-halt();
   }
}
Solution
I finally remembered it was mountAction() I was looking for.

//use Filament\Actions\Action;

    public function fooAction(): Action
    {
        return Action::make('foo'); 
               //->action(...)
    }

    protected function beforeCreate(): ?Action
    {
        if (true) {
            $this->mountAction('foo');
            $this->halt();
        }
    }
//use Filament\Actions\Action;

    public function fooAction(): Action
    {
        return Action::make('foo'); 
               //->action(...)
    }

    protected function beforeCreate(): ?Action
    {
        if (true) {
            $this->mountAction('foo');
            $this->halt();
        }
    }
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

beforecreate() hook returning error
FilamentFFilament / ❓┊help
3y ago
Get form values in beforeCreate() hook
FilamentFFilament / ❓┊help
2y ago
Dispatch event in lifecycle hook
FilamentFFilament / ❓┊help
2y ago
How open modal in mount, filament page
FilamentFFilament / ❓┊help
13mo ago