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
use
->action()
on the DeleteAction::make()
classthanks, I was trying to use
->before()
and ->failureNotification()
, thank youaction is your goto