Illuminate\Database\Query\Builder::having PHP Method

having() public method

Add a "having" clause to the query.
public having ( string $column, string $operator = null, string $value = null, string $boolean = 'and' )
$column string
$operator string
$value string
$boolean string
    public function having($column, $operator = null, $value = null, $boolean = 'and')
    {
        $type = 'basic';
        $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
        if (!$value instanceof Expression) {
            $this->addBinding($value, 'having');
        }
        return $this;
    }

Usage Example

 /**
  * Perform column filtering
  *
  * @return mixed
  */
 public function filtering()
 {
     $filters = $this->request->getFilter();
     if ($filters) {
         $this->columnMapping();
         foreach ($filters as $key => $keyword) {
             $keyword = '%' . $keyword . '%';
             $column = $this->getColumnName($key);
             if (in_array($key, $this->havingColumns)) {
                 $this->query->having($key, 'like', $keyword);
                 continue;
             }
             $this->query->where($column, 'like', $keyword);
         }
     }
 }
All Usage Examples Of Illuminate\Database\Query\Builder::having