Sunday 15 January 2012

php - Laravel 4 Cascading Soft Deletes -


Is there a modular way to soften cascading in L4?

Do this with my databases already being hard removed because all tables are related to another .. However, I am using soft delete and actually in my model delete ( ) The method does not want to overload - due to the just (a) the quantity of the model, and (b) changing the other model when editing the delete method in all models.

Any pointers or suggestions will be appreciated.

Cascading removes deleted work, for example, in a product model, I delete deleted events I can soften all relationships, so I can soften all relationships:

  // Similar to Laravel equivalent to calling the constructor on a model public static function boot (); : Boot (); // A product is cascadeed due to soft delete so that they are soft removed static :: deleted (function ($ product) {$ product- & gt; images} -> delete ($); $ Product- & gt; Description () - & gt; Delete (); Foreign Exchange ($ product-> as variant $ variant) {$ variant-> Option () - & gt; Delete (); $ Version-> delete ();}}); }    

No comments:

Post a Comment