Skip to content
Advertisement

Laravel onDelete(‘cascade’) does not work

My Tables:

I am getting following errors when I try to delete support_categories

Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails

Advertisement

Answer

You just write foreign key in wrong order.

Instead of:

Write:

or you can use casadeOnDelete():

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement