F
Filament12mo ago
Andy

Standalone action not hiding

I'm getting what feels like weird behaviour with an action. I'd like to conditionally hide the action but using ->hidden() just disables it.
public function testAction(): Action
{
return Action::make('test')
->hidden()
->label('Test Action')
->action(fn () => dd('TODO'));
}

public function testAction(): Action
{
return Action::make('test')
->hidden()
->label('Test Action')
->action(fn () => dd('TODO'));
}

No description
2 Replies
DrByte
DrByte12mo ago
Should hidden() be visible(Closure)?
LeandroFerreira
LeandroFerreira12mo ago
you should check the visibility in the view
{{ ($action = $this->testAction())->isVisible() ? $action : '' }}
{{ ($action = $this->testAction())->isVisible() ? $action : '' }}
Want results from more Discord servers?
Add your server