PHP Trait Eloquence\Behaviours\Cacheable

ファイルを表示 Open project: kirkbushell/eloquence

Public Methods

Method Description
rebuildCacheRecord ( array $config, Model $model, $command, null $aggregateField = null ) : mixed Rebuilds the cache for the records in question.
updateCacheRecord ( array $config, string $operation, integer | float | double $amount, string $foreignKey ) Updates a table's record based on the query information provided in the $config variable.

Protected Methods

Method Description
field ( string $model, string $field ) : string Creates the key based on model properties and rules.
getModelTable ( string | Model $model ) : mixed Returns the table for a given model. Model can be an Eloquent model object, or a full namespaced class string.
key ( string $field ) : mixed Returns the true key for a given field.
processConfig ( array $config ) : array Process configuration parameters to check key names, fix snake casing, etc.

Method Details

field() protected method

Creates the key based on model properties and rules.
protected field ( string $model, string $field ) : string
$model string
$field string
return string

getModelTable() protected method

Returns the table for a given model. Model can be an Eloquent model object, or a full namespaced class string.
protected getModelTable ( string | Model $model ) : mixed
$model string | Illuminate\Database\Eloquent\Model
return mixed

key() protected method

Returns the true key for a given field.
protected key ( string $field ) : mixed
$field string
return mixed

processConfig() protected method

.
protected processConfig ( array $config ) : array
$config array
return array

rebuildCacheRecord() public method

Rebuilds the cache for the records in question.
public rebuildCacheRecord ( array $config, Model $model, $command, null $aggregateField = null ) : mixed
$config array
$model Illuminate\Database\Eloquent\Model
$command
$aggregateField null
return mixed

updateCacheRecord() public method

Updates a table's record based on the query information provided in the $config variable.
public updateCacheRecord ( array $config, string $operation, integer | float | double $amount, string $foreignKey )
$config array
$operation string Whether to increase or decrease a value. Valid values: +/-
$amount integer | float | double
$foreignKey string