Using the hidden modifier on an Action seems to be disabling, not hiding the action button.

I have this method with a custom action:
public function reopenAction(): Action
{
return Action::make('reopen')
->hidden(function () {
return ($this->isComplete == 1);
})
->size('sm')
->color('success')
->requiresConfirmation()
->action(fn () => $this->reopen())
->successNotificationTitle('reopened!');
}
public function reopenAction(): Action
{
return Action::make('reopen')
->hidden(function () {
return ($this->isComplete == 1);
})
->size('sm')
->color('success')
->requiresConfirmation()
->action(fn () => $this->reopen())
->successNotificationTitle('reopened!');
}
This is what's in my blade file: {{ $this->reopenAction }} The action button is not actually being hidden, it's just being disabled. I've tried various different methods, including just hard-coding a boolean value: ->hidden(false) <-- enables the action button ->hidden(true) <-- disables the action button in both cases the button is still visible.
4 Replies
LeandroFerreira
LeandroFerreira11mo ago
{{ ($action = $this->reopenAction())->isVisible() ? $action : '' }}
{{ ($action = $this->reopenAction())->isVisible() ? $action : '' }}
Jon Mason
Jon MasonOP11mo ago
no joy..
LeandroFerreira
LeandroFerreira11mo ago
Does the ->hidden() work? share the whole code please
Jon Mason
Jon MasonOP11mo ago
public function submitAction(): Action
{
return Action::make('submit')
->size('sm')
->requiresConfirmation()
->action(fn (array $arguments) => $this->submitRollover($arguments))
->visible(!$this->partsRollover->is_complete)
->successNotificationTitle('Rollover Submitted!');
}

public function reopenAction(): Action
{
return Action::make('reopen')
->size('sm')
->color('success')
->requiresConfirmation()
->action(fn () => $this->reopen())
->visible($this->partsRollover->is_complete)
->successNotificationTitle('Rollover reopened!');
}
public function submitAction(): Action
{
return Action::make('submit')
->size('sm')
->requiresConfirmation()
->action(fn (array $arguments) => $this->submitRollover($arguments))
->visible(!$this->partsRollover->is_complete)
->successNotificationTitle('Rollover Submitted!');
}

public function reopenAction(): Action
{
return Action::make('reopen')
->size('sm')
->color('success')
->requiresConfirmation()
->action(fn () => $this->reopen())
->visible($this->partsRollover->is_complete)
->successNotificationTitle('Rollover reopened!');
}
{{ ($submitAction = $this->submitAction(['submittingSelected' => true]))->isHidden() ? $submitAction : '' }}
{{ ($reopenAction = $this->reopenAction())->isHidden() ? $reopenAction : '' }}
{{ ($submitAction = $this->submitAction(['submittingSelected' => true]))->isHidden() ? $submitAction : '' }}
{{ ($reopenAction = $this->reopenAction())->isHidden() ? $reopenAction : '' }}
This works as far as making the buttons appear/disappear now, but when the buttons are shown they're both disabled.
Want results from more Discord servers?
Add your server