QueryBuilder
class Winter\Storm\Database\QueryBuilder
extends Illuminate\Database\Query\Builder
Extends
| Class | Description |
|---|---|
Illuminate\Database\Query\Builder
|
Properties
public
$concats
:
array
= []
The aliased concatenation columns.
protected $cacheKey : string
The key that should be used when caching the query.
protected $cacheMinutes : int | null
The number of minutes to cache the query.
protected $cacheTags : array
The tags for the query cache.
protected
$cachingDuplicateQueries
:
bool
= false
Indicates whether duplicate queries are being cached in memory.
Methods
public cacheTags (array | mixed $cacheTags) : $this
Indicate that the results, if cached, should use the given cache tags.
| Property | Type | Description |
|---|---|---|
| $cacheTags | array | mixed |
array | mixed
|
public cachingDuplicates () : bool
Determine whether we're caching duplicate queries.
public
clearDuplicateCache (string | null $table = null)
: Illuminate\Database\Query\Builder | static
Clear memory cache for the given table.
| Property | Type | Description |
|---|---|---|
| $table | string | null |
string | null
|
public
count (string $columns = "*")
: integer
Retrieve the "count" result of the query, also strips off any orderBy clause.
| Property | Type | Description |
|---|---|---|
| $columns | string |
string
|
public
delete (mixed $id = null)
: int
Delete a record from the database.
| Property | Type | Description |
|---|---|---|
| $id | mixed |
mixed
|
public disableDuplicateCache () : static
Disable the memory cache on the query.
public enableDuplicateCache () : static
Enable the memory cache on the query.
public flushDuplicateCache () : Illuminate\Database\Query\Builder | static
Flush the memory cache.
public generateCacheKey () : string
Generate the unique cache key for the query.
public
get (array $columns = ["*"])
| Property | Type | Description |
|---|---|---|
| $columns | array |
array
|
public getCacheKey () : string
Get a unique cache key for the complete query.
public
getCached (array $columns = ["*"])
: BaseCollection
Execute the query as a cached "select" statement.
| Property | Type | Description |
|---|---|---|
| $columns | array |
array
|
public
getCountForPagination (array $columns = ["*"])
: int
Get the count of the total records for the paginator.
| Property | Type | Description |
|---|---|---|
| $columns | array |
array
|
public insert (array $values) : bool
Insert a new record into the database.
| Property | Type | Description |
|---|---|---|
| $values | array |
array
|
public
insertGetId (array $values, string $sequence = null)
: int
Insert a new record and get the value of the primary key.
| Property | Type | Description |
|---|---|---|
| $values | array |
array
|
| $sequence | string |
string
|
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
remember (DateTime | int $minutes, string $key = null)
: $this
Indicate that the query results should be cached.
| Property | Type | Description |
|---|---|---|
| $minutes | DateTime | int |
DateTime | int
|
| $key | string |
string
|
public
rememberForever (string $key = null)
: Illuminate\Database\Query\Builder | static
Indicate that the query results should be cached forever.
| Property | Type | Description |
|---|---|---|
| $key | string |
string
|
public selectConcat (array $parts, string $as) : $this
Adds a concatenated column as an alias.
| Property | Type | Description |
|---|---|---|
| $parts | array |
array
The concatenation parts. |
| $as | string |
string
The name of the alias for the compiled concatenation. |
public truncate () : void
Run a truncate statement on the table.
public update (array $values) : int
Update a record in the database.
| Property | Type | Description |
|---|---|---|
| $values | array |
array
|
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 cloneForPaginationCount () : self
Clone the existing query instance for usage in a pagination subquery.
protected getCache () : Illuminate\Cache\CacheManager
Get the cache object with tags assigned, if applicable.
protected getCacheCallback (array $columns) : Closure
Get the Closure callback used when caching queries.
| Property | Type | Description |
|---|---|---|
| $columns | array |
array
|
protected getCacheInfo () : array
Get the cache key and cache minutes as an array.
protected
getDuplicateCached (array $columns = ["*"])
: BaseCollection
Check the memory cache before executing the query
| Property | Type | Description |
|---|---|---|
| $columns | array |
array
|
protected
runPaginationCountQuery (array $columns = ["*"])
: array
Run a pagination count query.
| Property | Type | Description |
|---|---|---|
| $columns | array |
array
|