How can remove the row delete button if record match some conditions in ModelResource #1427
Answered
by
lee-to
WillieOng-HK
asked this question in
Q&A
-
How can remove the row delete button if record match some conditions in Model Resource |
Beta Was this translation helpful? Give feedback.
Answered by
lee-to
Dec 27, 2024
Replies: 1 comment
-
We already have a package based on spatie with support for version 3 If you still want to implement it yourself, here are the materials https://moonshine-laravel.com/en/docs/3.x/model-resource/authorization https://moonshine-laravel.com/en/docs/3.x/security/authorization#additional_logic You can also just hide the button protected function modifyDeleteButton(ActionButtonContract $button): ActionButtonContract
{
return $button->canSee(fn($data) => true|false);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
WillieOng-HK
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We already have a package based on spatie with support for version 3
https://github.com/SWEET1S/moonshine-roles-permissions
If you still want to implement it yourself, here are the materials
https://moonshine-laravel.com/en/docs/3.x/model-resource/authorization
https://moonshine-laravel.com/en/docs/3.x/security/authorization#additional_logic
You can also just hide the button
https://moonshine-laravel.com/en/docs/3.x/model-resource/buttons#delete