Esempio n. 1
0
 protected static function boot()
 {
     parent::boot();
     // static::updating(function ($product) {
     //     $changed = $product->isDirty() ? $product->getDirty() : false;
     //     if ($changed && $changed['options']) {
     //         // maintain stock
     //         print_r($changed['options']);
     //     }
     // });
     static::deleting(function ($product) {
         $ids = ProductPhoto::select()->where('product_id', '=', $product->id)->lists('id');
         ProductPhoto::destroy($ids->toArray());
     });
 }