You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After researching about this, we found out that the only way to do it is capturing the Illuminate\Database\QueryException and checking the SQLSTATE number and the error number obtaining them from the Exception instance errorInfo property ($e->errorInfo).
Which SQL errors should crud capture and show as user friendly messages?
Error: 1451 SQLSTATE: 23000 (ER_ROW_IS_REFERENCED_2)
Message: Cannot delete or update a parent row: a foreign key constraint fails (%s)
Error: 1452 SQLSTATE: 23000 (ER_NO_REFERENCED_ROW_2)
Message: Cannot add or update a child row: a foreign key constraint fails (%s)
Show a friendly error message when it's not possible to delete a content because it has other contents related.
The text was updated successfully, but these errors were encountered: