raw() public method

Get a new raw query expression.
public raw ( mixed $value ) : Illuminate\Database\Query\Expression
$value mixed
return Illuminate\Database\Query\Expression
Exemplo n.º 1
0
 /**
  * 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]);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Create a raw database expression.
  *
  * @param  mixed  $value
  * @return \Illuminate\Database\Query\Expression
  */
 public function raw($value)
 {
     return $this->connection->raw($value);
 }
Exemplo n.º 3
0
 /**
  * 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();
 }