/** * Perform column search. */ public function doColumnSearch() { $columns = $this->input['columns']; for ($i = 0, $c = count($columns); $i < $c; $i++) { if ($this->isColumnSearchable($columns, $i)) { $column = $columns[$i]['name']; $keyword = $this->setupKeyword($columns[$i]['search']['value']); if (isset($this->filter_columns[$column])) { $method = $this->filter_columns[$column]['method']; $parameters = $this->filter_columns[$column]['parameters']; $this->compileFilterColumn($method, $parameters, $column); } else { $column = $this->wrapValue($column); if ($this->isCaseInsensitive()) { $this->query->whereRaw('LOWER(' . $column . ') LIKE ?', [Str::lower($keyword)]); } else { $col = strstr($column, '(') ? $this->connection->raw($column) : $column; $this->query->whereRaw($col . ' LIKE ?', [$keyword]); } } } } }
/** * Create a raw database expression. * * @param mixed $value * @return \Illuminate\Database\Query\Expression */ public function raw($value) { return $this->connection->raw($value); }
/** * get number Notifications * not read. * * @param $toId * @param $entity * @param Closure $filterScope * @return mixed */ public function countNotRead($toId, $entity, Closure $filterScope = null) { $query = $this->notification->wherePolymorphic($toId, $entity)->withNotRead()->select($this->db->raw('Count(*) as notRead')); $query = $this->applyFilter($filterScope, $query); return $query->count(); }