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

cklester's avatar

Deleting Record Also Deletes Related Records?

Is Eloquent smart enough to delete records in a "pivot table" when I delete a record?

If I have three tables, 'books,' 'readers,' and 'book_reader,' and I delete a book, all the records in 'book_reader' with that book_id should be deleted automagically. That's what I expect. What would happen IRL? :D

0 likes
2 replies
cklester's avatar

I've done a bit more searching. I might just softDelete the records for now... I'm still interested in hearing answers and other approaches.

Please or to participate in this conversation.