public static function deleting($event, Node $node) { // Update children's parents foreach (self::where('parent_id = ?', [$node->id])->get() as $child) { $child->parent_id = $node->parent_id; $child->save(); } }