Whether all conditions are met
@param array $trigger
@param array $data
@return boolean
2018
public function isMet(array $trigger, array $data)
    {
        $result = null;
        $this->hook->attach('condition.met.before', $trigger, $data, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        if (empty($trigger['data']['conditions'])) {
            return false;
        }

        $result = true;
        $this->processed = array();

        foreach ($trigger['data']['conditions'] as $condition) {

            if ($this->callHandler($condition, $data) !== true) {
                $result = false;
                break;
            }

            $this->processed[] = $condition['id'];
        }

        $this->hook->attach('condition.met.after', $trigger, $data, $result, $this);
        return (bool) $result;
    }
1341215
public static function trigger($name, $data = [], $target = null, $paramClass = EventParam::class)
    {
        static::getInstance()->__trigger($name, $data, $target, $paramClass);
    }
924198
public function product(array $condition, array $data)
    {
        $is_product = (int) isset($data['product_id']);
        $value = (int) filter_var(reset($condition['value']), FILTER_VALIDATE_BOOLEAN);
        return $this->compare($is_product, $value, $condition['operator']);
    }
144352
public function findOrInit($conditions = false, $data = array())
    {
        if (!$this->find($conditions)) {
            // Reset status when record not found
            $this->isNew = true;

            !is_array($conditions) && $conditions = array($this->primaryKey => $conditions);

            // Convert to object to array
            if (is_object($data) && method_exists($data, 'toArray')) {
                $data = $data->toArray();
            }

            // conditions data are fillable
            $this->fromArray($data);
            $this->setData($conditions);
        }
        return $this;
    }
733304
public function shippingMethod(array $condition, array $data)
    {
        if (!isset($data['order']['shipping'])) {
            return false;
        }

        return $this->compare($data['order']['shipping'], $condition['value'], $condition['operator']);
    }
444519
protected function checkBeforeSave($data, $where)
    {
        if (!empty($data)) {

            // 数据对象赋值
            foreach ($data as $key => $value) {
                $this->setAttr($key, $value, $data);
            }

            if (!empty($where)) {
                $this->exists      = true;
                $this->updateWhere = self::parseWhere($where);
            }
        }

        // 数据自动完成
        $this->autoCompleteData($this->auto);

        // 事件回调
        if (false === $this->trigger('before_write')) {
            return false;
        }

        return true;
    }
453649
public function has($q = [], $data = [])
    {
        $q['table'] = $this->table;
        return $this->db->has($q, $data);
    }
225763
public static function updateOne($conditions, array $data)
    {
        $db = static::getDb();
    
        $bool = $db->update(
            (new self())->getSource(),
            array_keys($data),
            array_values($data),
            $conditions
        );

        return $bool;
    }
563251
public function trigger($event, $data = null) {
		$event = strtolower(trim($event));
		if (!isset($this->_events[$event])) return $data;

		foreach ($this->_events[$event] as $callback) {
			// we don't want to affect the data if someone forgets to return the original data in his callback. 
			$result = call_user_func($callback, $event, $data);
			if ($result !== null) $data = $result;
		}

		return $data;
	}
414081
public function checkExistsAndInsertData($data = [], $wheres = [])
    {
        $this->connection();
        $db = DB::table($this->table);
        if (is_array($wheres) && count($wheres) > 0) {
            foreach ($wheres as $field => $value) {
                if (is_array($value)) {
                    $db->whereIn($field, $value);
                } else {
                    $db->where($field, self::OPERATOR_EQUAL_TO, $value);
                }
            }
        } else {
            $db->where($this->primaryKey, self::OPERATOR_EQUAL_TO, $wheres);
        }
        $checkExists = $db->count();
        $this->debug->debug(__FUNCTION__, 'Check Exists Data: ' . $checkExists);
        if (!$checkExists) {
            $id = $db->insertGetId($data);
            $this->debug->debug(__FUNCTION__, 'SQL Queries: ' . $db->toSql());
            $this->debug->debug(__FUNCTION__, 'Result Insert ID: ' . $id);

            return $id;
        } else {
            $this->debug->debug(__FUNCTION__, 'Đã tồn tại bản ghi, bỏ qua không ghi nữa');

            return FALSE;
        }
    }
205094
protected function doUpdateBatch($data, array $conditions)
    {
        !$this->useTransaction ?: $this->db->getTransaction(true)->start();

        try {
            $result = $this->db->getWriter()->updateBatch($this->table, $data, $conditions);
        } catch (\Throwable $e) {
            !$this->useTransaction ?: $this->db->getTransaction(true)->rollback();

            throw $e;
        }

        !$this->useTransaction ?: $this->db->getTransaction(true)->commit();

        return $result;
    }
134548
public static function is_valid(array $data, array $validators) {
        $gump = self::get_instance();

        $gump->validation_rules($validators);

        if ($gump->run($data) === false) {
            return $gump->get_errors_array(false);
        } else {
            return true;
        }
    }
55921
protected function searchTriggers($trigger)
    {
        synapse()->triggers->each(function ($class) use ($trigger) {
            $triggerClass = "\\Axiom\\Rivescript\\Cortex\\Triggers\\$class";
            $triggerClass = new $triggerClass();

            $found = $triggerClass->parse($trigger, $this->input);

            if ($found === true) {
                $this->getResponse($trigger);

                return false;
            }
        });
    }
1007930
public function create(array $data)
    {
        if ( $this->validator->with($data)->passes() )
        {
            $data['permissions'] = explode(',', $data['permissions']);
            $this->permission->create($data);
            return true;
        }
        else
        {
            return false;
        }
    }
1004632
protected function isEmpty($data, $exceptions)
    {
        if ($data == '') {
            $this->throwException($data, ' $data is Empty', $exceptions);
            return true;
        }
        return false;
    }
144986
public function id(array $condition, array $data)
    {
        if (empty($data['product_id'])) {
            return false;
        }

        return $this->compare($data['product_id'], $condition['value'], $condition['operator']);
    }
13627
private function triggerExists($trigger_name)
    {
        if ($triggers = $this->getConnection()->execute('SHOW TRIGGERS', $trigger_name)) {
            foreach ($triggers as $trigger) {
                if ($trigger['Trigger'] == $trigger_name) {
                    return true;
                }
            }
        }

        return false;
    }