model = $query->applyRelation($this->relation); $modifiers = $this->getModifiers(); $where = DB::getConn()->comparisonClause( $this->getDbName(), '%' . Convert::raw2sql($this->getValue()) . '%', false, // exact? false, // negate? $this->getCaseSensitive() ); return $query->where($where); } protected function applyMany(DataQuery $query) { $this->model = $query->applyRelation($this->relation); $where = array(); $modifiers = $this->getModifiers(); foreach($this->getValue() as $value) { $where[]= DB::getConn()->comparisonClause( $this->getDbName(), '%' . Convert::raw2sql($value) . '%', false, // exact? false, // negate? $this->getCaseSensitive() ); } return $query->where(implode(' OR ', $where)); } protected function excludeOne(DataQuery $query) { $this->model = $query->applyRelation($this->relation); $modifiers = $this->getModifiers(); $where = DB::getConn()->comparisonClause( $this->getDbName(), '%' . Convert::raw2sql($this->getValue()) . '%', false, // exact? true, // negate? $this->getCaseSensitive() ); return $query->where($where); } protected function excludeMany(DataQuery $query) { $this->model = $query->applyRelation($this->relation); $where = array(); $modifiers = $this->getModifiers(); foreach($this->getValue() as $value) { $where[]= DB::getConn()->comparisonClause( $this->getDbName(), '%' . Convert::raw2sql($value) . '%', false, // exact? true, // negate? $this->getCaseSensitive() ); } return $query->where(implode(' AND ', $where)); } public function isEmpty() { return $this->getValue() === array() || $this->getValue() === null || $this->getValue() === ''; } }