Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint
i have this error. i know that there i have somewhere foreign key but, is it any way to fix it in code ? or in db?
3 Replies
you can use ondeletecascade on your migration or try to delete them using Observer or by adding the >actions() method to the deleteAction
can u give me a example?
when i try to add deleteAction i have error
Method Filament\Actions\DeleteAction::table does not exist.
i add ondeltecascade on migration and
when i try to run migrations i have erorr
SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'purchases_company_id_foreign'; check that column/key exists (Connection: mysql, SQL: alter table
purchases drop foreign key
purchases_company_id_foreign)
because purchases do not exist