Prevent / Lock Particular Id from Deleted

Hi all , i have a question . I have 5 ids in RoleResource . My question is, how to lock or prevent some particular id from being deleted ? Because i have set auto assign role during register form . So wanted to prevent the user from delete that id .
2 Replies
Vp
Vp2mo ago
Tables\Actions\DeleteAction::make()
->hidden(fn (Model $record) => $record->whereIn('id', [1])),
Tables\Actions\DeleteAction::make()
->hidden(fn (Model $record) => $record->whereIn('id', [1])),
You can also use where This method hide delete button in list for id=1
awcodes
awcodes2mo ago
I would recommend a policy for the role model. That way it can’t be deleted at all. This will also hide the button for that record in the table.