amaelftah/laravel-trix

Soft deleting trix_rich_texts and trix_attachments for a model

mattgroom opened this issue · 3 comments

Hi

Just working on deleting records from one of my models, but notice that when soft deleting an entry, it doesn't cascade down and soft delete the entries in the trix database tables for the model I soft deleted. I couldn't see anything in the documentation about deleting records, so wanted to ask if I need to setup foreign keys on the tables so there is a link between entries to cascade down, or if there is a better way to achieve this? Any suggestion greatly appreciated.

Many thanks

Matt

hey Matt

i don't think you will need to add foreign keys . you can do this $post->trixRichText()->delete(); and this will permanetly delete the trix record

amazing - many thanks, I'll give that a go. Much appreciated - the trix package as worked great for the project. Thanks again!

glad you found it useful ☺️