jeudi 9 février 2017

Destroy model instance with all dependances in Laravel

I have two models with one-to-many connection. Let it be, for example, User ans UserComment models. When I'm calling User::destroy method, I also want to destroy each UserComment instance with user_id field equal to id of destroyed User. I may simply overload User::destroy method, but I wonder if there is better ways to achieve this.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kpowtj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire