Tricks

How to prevent deleting a record when it has a child record?

Oct 6, 2022
j
Form builder

Modify the delete action to delete button (or else) if child relationship exists

DeleteAction::make()->hidden(fn ($record) => $record->childRelationship()->exists())

No comments yet…