标签:merge on() cat 更新 ast nbsp each ack dba
// 获取子节点,并更新子节点状态 $as = XXXX::query()->where()->get(); while (true) { $categoryCollection = new Collection(); foreach ($as as $a) { $childBackCate[‘status‘] = $status; $childBackCate->save(); // 如果是最后一个节点就修改状态 if (!$childBackCate[‘is_last_son‘]) { // 如果不是最后一个节点就先修改状态,然后获取子节点再修改状态 $categories = CategoryBack::query()->where(‘parent_id‘, $childBackCate[‘id‘])->get(); $categoryCollection = $categoryCollection->merge($categories); } } if (count($categoryCollection) == 0) { break; } $childBackCategoryList = $categoryCollection; }
标签:merge on() cat 更新 ast nbsp each ack dba
原文地址:https://www.cnblogs.com/cjjjj/p/10398009.html