Builder

Query builder class.

 class Winter\Storm\Database\Builder
extends Illuminate\Database\Eloquent\Builder

Extends Eloquent builder class.

Extends

Properties

protected $model : Winter\Storm\Database\Model

The model being queried.

protected $query : Winter\Storm\Database\QueryBuilder

The base query builder instance.

Methods

public __call (string $method, array $parameters) : mixed

Dynamically handle calls into the query instance.

Parameters
Property Description
$method
string
$parameters
array
Returns
mixed

public lists (string $column, string | null $key = null) : array

Get an array with the values of a given column.

Parameters
Property Description
$column
string
$key
string | null
Returns
array

public orSearchWhere (string $term, array $columns = [], string $mode = "all") : self

Add an "or search where" clause to the query.

Parameters
Property Description
$term
string

Search query

$columns
array

Table columns to search

$mode
string

Search mode: all, any, exact.

Returns
self

public paginate (int | null $perPage = null, array | int | null $currentPage = null, array $columns = ["*"], string $pageName = "page") : Illuminate\Contracts\Pagination\LengthAwarePaginator

Paginate the given query.

This method also accepts the Laravel signature:

paginate(int|null $perPage, array $columns, string $pageName, int|null $page)

Parameters
Property Description
$perPage
int | null
$currentPage
array | int | null
$columns
array
$pageName
string
Returns
Illuminate\Contracts\Pagination\LengthAwarePaginator

public searchWhere (string $term, array $columns = [], string $mode = "all") : self

Perform a search on this query for term found in columns.

Parameters
Property Description
$term
string

Search query

$columns
array

Table columns to search

$mode
string

Search mode: all, any, exact.

Returns
self

public simplePaginate (int | null $perPage = null, array | int | null $currentPage = null, array $columns = ["*"], string $pageName = "page") : Illuminate\Contracts\Pagination\Paginator

Paginate the given query into a simple paginator.

This method also accepts the Laravel signature:

simplePaginate(int|null $perPage, array $columns, string $pageName, int|null $page)

Parameters
Property Description
$perPage
int | null
$currentPage
array | int | null
$columns
array
$pageName
string
Returns
Illuminate\Contracts\Pagination\Paginator

public upsert (array $values, array | string $uniqueBy, array | null $update = null) : int

Insert new records or update the existing ones.

Parameters
Property Description
$values
array
$uniqueBy
array | string
$update
array | null
Returns
int

protected addTimestampsToValues (array $values) : array

Add timestamps to the inserted values.

Parameters
Property Description
$values
array
Returns
array

protected addUpdatedAtToColumns (array $update) : array

Add the "updated at" column to the updated columns.

Parameters
Property Description
$update
array
Returns
array

protected searchWhereInternal ($term, $columns, $mode, $boolean)

Internal method to apply a search constraint to the query.

Mode can be any of these options:

  • all: result must contain all words
  • any: result can contain any word
  • exact: result must contain the exact phrase
Parameters
Property Description
$term
mixed
$columns
mixed
$mode
mixed
$boolean
mixed
Returns
mixed
Copyright © 2024 Winter CMS