发送客服消息
@param array $data
@return bool
181479
protected function sendCustomMessage(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_CUSTOM_MESSAGE_SEND_URL . 'access_token=' . $this->getAccessToken(), $data);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok';
    }
1161241
public function insert(array $data)
    {
        if (false === $this->trigger('before_insert', $this)) {
            return false;
        }

        if($this->dateFormat && $this->updateTime && $this->createTime){
            $time = date('Y-m-d H:i:s', time());
            $data[$this->updateTime] = $time;
            $data[$this->createTime] = $time;
        } else {
            $time =  time();
            $data[$this->updateTime] =  $time;
            $data[$this->createTime] =  $time;
        }

        $response = $this->getQuery()->insert($data);

        if (false === $this->trigger('after_insert', $this)) {
            return false;
        }
        return $response;
    }
790117
public function update(array $data)
    {
        $perm = $this->findOrFail($data['id']);

        $perm->name = $data['name'];
        $perm->permissions = $data['permissions'];
        $perm->save();

        $this->event->fire('permissions.update',array($perm));

        return true;
    }
226723
public function verify(array $data)
    {
        if (is_callable($this->callback)) {
            return call_user_func($this->callback, $data);
        }

        return false;
    }
1332212
public static function isSerialized($data) {
        if (!is_string($data) || empty($data)) {
            return false;
        }

        return (@unserialize($data) !== false);
    }
604795
public function isSupported(array $data)
    {
        try {
            new DateTime($data[$this->getProperty()]);
        } catch (Exception $e) {
            return false;
        }

        return true;
    }
1338526
public static function isTaken(?array $data = [])
  {
    if (count($data) == 1) {
      foreach($data as $field => $value) {
        return self::where($field, $value)->first() == null ? false: true;
      }
    }

    $response = array();
    foreach($data as $field => $value) {
      $check = self::where($field, $value)->first();

      $response = array_merge($response, array($field => $check == null ? false : true));
    }

    return $response;
  }
742076
public function validate($data)
    {
        if($this->skip_validation)
        {
            return $data;
        }

        if(!empty($this->validate))
        {
            foreach($data as $key => $val)
            {
                $_POST[$key] = $val;
            }

            $this->load->library('form_validation');

            if(is_array($this->validate))
            {
                $this->form_validation->set_rules($this->validate);

                if ($this->form_validation->run() === TRUE)
                {
                    return $data;
                }
                else
                {
                    return FALSE;
                }
            }
            else
            {
                if ($this->form_validation->run($this->validate) === TRUE)
                {
                    return $data;
                }
                else
                {
                    return FALSE;
                }
            }
        }
        else
        {
            return $data;
        }
    }
645880
public function update(array $data)
    {
        try
        {
            if ( $this->validator->with($data)->validForUpdate() )
            {
                $this->users->update($data['id'], $this->validator->getData());
                return true;
            }
        }
        catch (LoginRequiredException $e)
        {
            $this->validator->add('LoginRequiredException',$e->getMessage());
        }
        catch (PasswordRequiredException $e)
        {
            $this->validator->add('PasswordRequiredException',$e->getMessage());
        }
        catch (UserExistsException $e)
        {
            $this->validator->add('UserExistsException',$e->getMessage());
        }

        return false;
    }
227171
public static function sumColumns(array $data)
    {
        $columns = self::arrayColumns($data);

        if ($columns !== false){
            return self::columnSum($data, $columns);
        } else {
            return false;
        }
    }
1291467
public function save($data)
    {
        if ($data instanceof Model) {
            $data = $data->getData();
        }
        // 保存关联表数据
        $pk = $this->parent->getPk();

        $model = new $this->model;

        $data[$this->morphKey]  = $this->parent->$pk;
        $data[$this->morphType] = $this->type;
        return $model->save($data) ? $model : false;
    }
840540
public function updateDepartment(array $data)
    {
        $result = $this->httpRaw(self::WECHAT_DEPARTMENT_UPDATE_PREFIX, $data, [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errcode']) && ($result['errcode'] ? $this->dump([$data,$result,$this->getAccessToken()]) : !$result['errcode']);
    }
270433
public function getData($data)
    {
        if ($this->hasData($data)) {
            return $this->getAttribute(sprintf('data-%s', $data));
        } else {
            return false;
        }
    }
941528
public function getIsAllValuesValid(array $data)
    {
        foreach($data as $value)
        {
            if(!$this->getIsValidValue($value))
            {
                return false;
            }
        }
        return true;
    }
708332
public function validate(array $data)
    {
        $rules = $this->getRules();
        foreach ($rules as $field => $rule) {
            if ((isset($rule['required']) && $rule['required'] === true && isset($data[$field]))
                || ((!isset($rule['required']) || !$rule['required'])) && isset($data[$field])) {
                foreach ($rule as $key => $value) {
                    if ($key !== 'required') {
                        foreach ($value as $validator) {
                            if (!is_array($validator)) {
                                $validator = [$validator];
                            }
                            if (!Validator::validate($validator[0], $field,
                                    $data, $validator)) {
                                $this->addError($field,
                                    isset($rule['errorMessage']) ? $rule['errorMessage']
                                            : false);
                            }
                        }
                    }
                }
            } elseif (isset($rule['required']) && $rule['required'] === true) {
                $this->addError($field,
                    isset($rule['errorMessage']) ? $rule['errorMessage'] : false);
            }
        }
        return !$this->hasErrors();
    }
783856
public function data(array $data = null)
    {
        if (is_null($data)) {
            return $this->data;
        }

        $this->data = $data;

        return $this;
    }
236862
public function create(array $data)
    {
        try
        {
            if ($this->validator->with($data)->passes())
            {
                $this->groups->create($data);
                return true;
            }
        }
        catch (GroupExistsException $e)
        {
            $this->validator->add('GroupExistsException', $e->getMessage());
        }
        catch (NameRequiredException $e)
        {
            $this->validator->add('NameRequiredException', $e->getMessage());
        }

        return false;
    }