Handling Model Deletion with onDelete('restrict')

I set onDelete('restrict') in my model migration to prevent deleting records with active relationships. However, I still face an "Integrity constraint violation" error when attempting deletion. How can I handle this to stop the error and notify users that they can't delete records with active relationships?
3 Replies
Hussain4real
Hussain4real10mo ago
use ->action() on the DeleteAction::make() class
Bruno Silva
Bruno SilvaOP10mo ago
thanks, I was trying to use ->before() and ->failureNotification(), thank you
Hussain4real
Hussain4real10mo ago
action is your goto
Want results from more Discord servers?
Add your server