where('level', $params['level']); } if (!empty($params['parent_id'])) { $query->where('parent_id', $params['parent_id']); } if (!empty($params['account'])) { $query->where('account', 'like', '%' . $params['account'] . '%'); } if (!empty($params['mobile'])) { $query->where('mobile_phone', 'like', '%' . $params['mobile'] . '%'); } if (!empty($params['idcard'])) { $query->where('idcard', 'like', '%' . $params['idcard'] . '%'); } if (!empty($params['realname'])) { $query->where('real_name', 'like', '%' . $params['realname'] . '%'); } if (isset($params['status']) && $params['status'] != -1) { $query->where('status', $params['status']); } } /** * 查找子推广账号 */ public function scopeOfParent($query, $promote) { return $query->where('chain', 'like', $promote->chain . $promote->id . '/%'); } }