update:支持无限级部门搜索

This commit is contained in:
JaguarJack
2020-11-04 08:20:15 +08:00
parent a9671b6227
commit 0b5c883012
2 changed files with 26 additions and 2 deletions

View File

@@ -22,8 +22,10 @@ trait UserSearch
public function searchDepartmentIdAttr($query, $value, $data)
{
$departmentIds = Department::where('parent_id', $value)->column('id');
$departmentIds[] = $value;
$departmentIds = Department::getAllChildrenIds([$value]);
$departmentIds[] = intval($value);
return $query->whereIn($this->aliasField('department_id'), $departmentIds);
}
}