Hide header actions on edit page

Hello! I'm looking to customize the "delete" button on the edit page, to only show conditionally on my records. Is there a way to achieve this? Thanks!
Solution:
Solved! I wanted to disable the delete button if the current user editing is the same as the user in the model. So in EditUser.php: ```php...
Jump to solution
2 Replies
Solution
Diogo Pinto
Diogo Pinto16mo ago
Solved! I wanted to disable the delete button if the current user editing is the same as the user in the model. So in EditUser.php:
class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make()
->disabled(auth()->id() == $this->record->id),
];
}
}
class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make()
->disabled(auth()->id() == $this->record->id),
];
}
}
Amiejah
Amiejah11mo ago
when you say disable, you still want to display the button but disabled?
Want results from more Discord servers?
Add your server