Builder
Query builder class.
class Winter\Storm\Database\Builder
extends Illuminate\Database\Eloquent\Builder
Extends Eloquent builder class.
Extends
Class | Description |
---|---|
Illuminate\Database\Eloquent\Builder
|
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.
Property | Type | Description |
---|---|---|
$method | string |
string
|
$parameters | array |
array
|
public
lists (string $column, string | null $key = null
)
: array
Get an array with the values of a given column.
Property | Type | Description |
---|---|---|
$column | string |
string
|
$key | string | null |
string | null
|
public
orSearchWhere (string $term, array $columns = []
, string $mode = "all"
)
: self
Add an "or search where" clause to the query.
Property | Type | Description |
---|---|---|
$term | string |
string
Search query |
$columns | array |
array
Table columns to search |
$mode | string |
string
Search mode: all, any, exact. |
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)
Property | Type | Description |
---|---|---|
$perPage | int | null |
int | null
|
$currentPage | array | int | null |
array | int | null
|
$columns | array |
array
|
$pageName | string |
string
|
public
searchWhere (string $term, array $columns = []
, string $mode = "all"
)
: self
Perform a search on this query for term found in columns.
Property | Type | Description |
---|---|---|
$term | string |
string
Search query |
$columns | array |
array
Table columns to search |
$mode | string |
string
Search mode: all, any, exact. |
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)
Property | Type | Description |
---|---|---|
$perPage | int | null |
int | null
|
$currentPage | array | int | null |
array | int | null
|
$columns | array |
array
|
$pageName | string |
string
|
public
upsert (array $values, array | string $uniqueBy, array | null $update = null
)
: int
Insert new records or update the existing ones.
Property | Type | Description |
---|---|---|
$values | array |
array
|
$uniqueBy | array | string |
array | string
|
$update | array | null |
array | null
|
protected addTimestampsToValues (array $values) : array
Add timestamps to the inserted values.
Property | Type | Description |
---|---|---|
$values | array |
array
|
protected addUpdatedAtToColumns (array $update) : array
Add the "updated at" column to the updated columns.
Property | Type | Description |
---|---|---|
$update | array |
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
Property | Type | Description |
---|---|---|
$term | mixed |
mixed
|
$columns | mixed |
mixed
|
$mode | mixed |
mixed
|
$boolean | mixed |
mixed
|