Answer the question
In order to leave comments, you need to log in
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails... Laravel 5.6.?
I have news and categories for them. Communication - many to many. When I try to delete the news, I get this error. Found a solution online by adding onDelete to the migration. But this method does not work with a many-to-many relationship, because there is nothing in the migration of news and categories, and the relationship is implemented only with the help of a linking table. Tell me, is there a way to beautifully solve this problem, or is it worth climbing into the linking table each time you delete the news and first deleting the record from there?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question