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();
   }
}
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();
        }
    }
Was this page helpful?