Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

brakkar's avatar

Cascade delete of a many to many relation table

Hi, let's say I have 3 tables

  • contacts
  • events
  • tags

and a table for relations:

  • taggable, with fields: tag_id, taggable_id and taggable_type

This is the kind of structure shown in laravel documentation.

Correct me if i'm wrong: the taggable_id field is not a real foreign key field. Thus, how is the record supposed to be deleted since it can't benefit from cascade delete ? Should we do it manually ?

0 likes
1 reply

Please or to participate in this conversation.