Builder
        
        Query builder
    
    
 class Winter\Storm\Halcyon\BuilderProperties
public $columns : array | null
The columns that should be returned.
public $extensions : array | null
Filter the query by these file extensions.
public $fileMatch : string | null
Match files using the specified pattern.
public $from : string | null
The directory name which the query is targeting.
public $limit : int | null
The maximum number of records to return.
public $offset : int | null
The number of records to skip.
public $orders : array | null
The orderings for the query.
public $selectSingle : array | null
Query should pluck a single record.
protected $cacheDriver : string | null
The cache driver to be used.
protected $cacheKey : string | null
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 | null
The tags for the query cache.
protected $datasource : Winter\Storm\Halcyon\Datasource\DatasourceInterface
The datasource instance.
            
            
            
                protected
            
            
            $loadedFromCache
            
                :
                                                            bool
                                                                        
                        = false
                    
                            
        
        
        Internal variable to specify if the record was loaded from cache.
protected $model : Winter\Storm\Halcyon\Model
The model being queried.
protected $processor : Winter\Storm\Halcyon\Processors\Processor
The datasource query post processor instance.
Methods
public __call (string $method, array $parameters) : void
Handle dynamic method calls into the method.
| Property | Type | Description | 
|---|---|---|
| $method | string | string | 
| $parameters | array | array | 
public __construct (Winter\Storm\Halcyon\Datasource\DatasourceInterface $datasource, Winter\Storm\Halcyon\Processors\Processor $processor) : void
Create a new query builder instance.
| Property | Type | Description | 
|---|---|---|
| $datasource | Winter\Storm\Halcyon\Datasource\DatasourceInterface | Winter\Storm\Halcyon\Datasource\DatasourceInterface | 
| $processor | Winter\Storm\Halcyon\Processors\Processor | Winter\Storm\Halcyon\Processors\Processor | 
public cacheDriver (string $cacheDriver) : $this
Indicate that the results, if cached, should use the given cache driver.
| Property | Type | Description | 
|---|---|---|
| $cacheDriver | string | string | 
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 static clearInternalCache ()
Clears the internal request-level object cache.
public delete () : bool
Delete a record from the database.
public find (string $fileName) : mixed | static
Find a single template by its file name.
| Property | Type | Description | 
|---|---|---|
| $fileName | string | string | 
public first () : mixed | static
Execute the query and get the first result.
public from (string $dirName) : $this
Set the directory name which the query is targeting.
| Property | Type | Description | 
|---|---|---|
| $dirName | string | string | 
public generateCacheKey () : string
Generate the unique cache key for the query.
            
            
            
                public
            
                        
            get (array $columns = ["*"])
                            : Winter\Storm\Halcyon\Collection
                    
        
        Execute the query as a "select" statement.
| Property | Type | Description | 
|---|---|---|
| $columns | array | array | 
public getCacheKey () : string
Get a unique cache key for the complete query.
            
            
            
                public
            
                        
            getCached (array $columns = ["*"])
                            : array
                    
        
        Execute the query as a cached "select" statement.
| Property | Type | Description | 
|---|---|---|
| $columns | array | array | 
            
            
            
                public
            
                        
            getFresh (array $columns = ["*"])
                            : Winter\Storm\Halcyon\Collection | static[]
                    
        
        Execute the query as a fresh "select" statement.
| Property | Type | Description | 
|---|---|---|
| $columns | array | array | 
public getModel () : Winter\Storm\Halcyon\Model
public getModels (array $results) : \Winter\Storm\Halcyon\Model[]
Get the hydrated models.
| Property | Type | Description | 
|---|---|---|
| $results | array | array | 
public insert (array $values) : integer
Insert a new record into the datasource.
| Property | Type | Description | 
|---|---|---|
| $values | array | array The values to store in the model. | 
The filesize of the created model file.
public lastModified () : int
Returns the last modified time of the object.
public limit (int $value) : $this
Set the "limit" value of the query.
| Property | Type | Description | 
|---|---|---|
| $value | int | int | 
            
            
            
                public
            
                        
            lists (string $column, string $key = null)
                            : array
                    
        
        Get an array with the values of a given column.
| Property | Type | Description | 
|---|---|---|
| $column | string | string | 
| $key | string | string | 
public offset (int $value) : $this
Set the "offset" value of the query.
| Property | Type | Description | 
|---|---|---|
| $value | int | int | 
            
            
            
                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)
                            : $this
                    
        
        Indicate that the query results should be cached forever.
| Property | Type | Description | 
|---|---|---|
| $key | string | string | 
public setModel (Winter\Storm\Halcyon\Model $model) : $this
Set a model instance for the model being queried.
| Property | Type | Description | 
|---|---|---|
| $model | Winter\Storm\Halcyon\Model | Winter\Storm\Halcyon\Model | 
public skip (int $value) : Winter\Storm\Halcyon\Builder | static
Alias to set the "offset" value of the query.
| Property | Type | Description | 
|---|---|---|
| $value | int | int | 
public take (int $value) : Winter\Storm\Halcyon\Builder | static
Alias to set the "limit" value of the query.
| Property | Type | Description | 
|---|---|---|
| $value | int | int | 
public toCompiled () : string
Get the compiled file content representation of the query.
            
            
            
                public
            
                        
            update (array $values = [])
                            : integer
                    
        
        Update a record in the datasource.
| Property | Type | Description | 
|---|---|---|
| $values | array | array The values to store in the model. | 
The filesize of the created model file.
public whereFileName (string $fileName) : $this
Switches mode to select a single template by its name.
| Property | Type | Description | 
|---|---|---|
| $fileName | string | string | 
protected getCache () : Illuminate\Contracts\Cache\Repository
Get the cache object with tags assigned, if applicable.
protected getCacheCallback (string | array $columns) : Closure
Get the Closure callback used when caching queries.
| Property | Type | Description | 
|---|---|---|
| $columns | string | array | string | array | 
protected isCacheBusted (array $result) : bool
Returns true if the cache for the file is busted. This only applies to single record selection.
| Property | Type | Description | 
|---|---|---|
| $result | array | array | 
protected processInitCacheData (Winter\Storm\Halcyon\Collection | array $data) : Winter\Storm\Halcyon\Collection | array
Initialize the cache data of each record.
| Property | Type | Description | 
|---|---|---|
| $data | Winter\Storm\Halcyon\Collection | array | Winter\Storm\Halcyon\Collection | array | 
protected runSelect () : array
Run the query as a "select" statement against the datasource.
            
            
            
                protected
            
                        
            validateFileName (string $fileName = null)
                    
        
        Validate the supplied filename, extension and path.
| Property | Type | Description | 
|---|---|---|
| $fileName | string | string | 
protected validateFileNameExtension (string $fileName, array $allowedExtensions) : void
Validates whether a file has an allowed extension.
| Property | Type | Description | 
|---|---|---|
| $fileName | string | string Specifies a path to validate | 
| $allowedExtensions | array | array A list of allowed file extensions | 
            
            
            
                protected
            
                        
            validateFileNamePath (string $filePath, integer $maxNesting = 2)
                            : bool
                    
        
        Validates a template path.
Template directory and file names can contain only alphanumeric symbols, dashes and dots.
| Property | Type | Description | 
|---|---|---|
| $filePath | string | string Specifies a path to validate | 
| $maxNesting | integer | integer Specifies the maximum allowed nesting level | 
protected validateFileNamePattern (string $fileName) : bool
Validates a template file or directory name.
template file names can contain only alphanumeric symbols, dashes, underscores and dots.
| Property | Type | Description | 
|---|---|---|
| $fileName | string | string Specifies a path to validate | 
Returns true if the file name is valid. Otherwise returns false.