Exemplo n.º 1
0
 protected function willBeUpdated($dirty)
 {
     $this->filterImportantUpdatedAttributes($dirty, function ($field, $type, $modifiers) use($dirty) {
         $capture = !hasUpdateModifier('-', $modifiers);
         $update = $this->checkChange($field, $dirty, $type, $capture);
         if ($update && !$capture) {
             $similar = $update->similar()->withTrashed();
             // pgsql restriction bypass
             $ids = [];
             foreach ($similar->get() as $update) {
                 $ids[] = $update->id;
             }
             $updates = Update::whereIn('id', $ids)->withTrashed();
             $updates->forceDelete();
         }
     });
 }