trait CacheableEloquentRepositoryTrait

Trait CacheableEloquentRepositoryTrait

Traits

Properties

static protected array $models model class name from EloquentRepositoryTrait

Methods

Model
update(Model $item, array $data = array())

update

bool|null
delete(Model $item)

delete

int
increment(Model $item, string $column, int $amount = 1)

Increment a column's value by a given amount.

int
decrement(Model $item, string $column, int $amount = 1)

Decrement a column's value by a given amount.

static string
getModel()

The name of Category model class

static void
setModel(string $model)

Set the name of Category model

Model
createModel()

Create model instance

Builder
query()

query

mixed
__call(string $name, array $arguments)

__call

mixed
cacheCall(string $method, array $arguments, Closure $closure)

Cache given callback

void
storeCacheKey(string $class, string $cacheKey)

Store cache key

void
clearCache()

Remove all cache data

string
makeHash(array $args)

Make hash string

Application|mixed
resolveContainer(string|null $service = null)

Resolve a service instance

array
getCacheKeys()

Get all cache keys

string
getKeyfile()

Returns a file path for hash keys

string|null
getNamespace()

Get namespace string for cache group

int
getLifetime()

Return cache life time (minute)

Model
create(array $attributes = array())

Create a model object

Details

at line 199
Model update(Model $item, array $data = array())

update

Parameters

Model $item item
array $data data

Return Value

Model

at line 216
bool|null delete(Model $item)

delete

Parameters

Model $item item

Return Value

bool|null

Exceptions

Exception

int increment(Model $item, string $column, int $amount = 1)

Increment a column's value by a given amount.

Parameters

Model $item item
string $column column
int $amount amount

Return Value

int

int decrement(Model $item, string $column, int $amount = 1)

Decrement a column's value by a given amount.

Parameters

Model $item item
string $column column
int $amount amount

Return Value

int

static string getModel()

The name of Category model class

Return Value

string

static void setModel(string $model)

Set the name of Category model

Parameters

string $model model class

Return Value

void

Model createModel()

Create model instance

Return Value

Model

Builder query()

query

Return Value

Builder

at line 232
mixed __call(string $name, array $arguments)

__call

Parameters

string $name method name
array $arguments arguments

Return Value

mixed

at line 45
mixed cacheCall(string $method, array $arguments, Closure $closure)

Cache given callback

Parameters

string $method method name
array $arguments arguments
Closure $closure closure

Return Value

mixed

at line 67
protected void storeCacheKey(string $class, string $cacheKey)

Store cache key

Parameters

string $class class name
string $cacheKey cache key

Return Value

void

at line 82
protected void clearCache()

Remove all cache data

Return Value

void

at line 113
protected string makeHash(array $args)

Make hash string

Parameters

array $args arguments

Return Value

string

at line 124
protected Application|mixed resolveContainer(string|null $service = null)

Resolve a service instance

Parameters

string|null $service service name

Return Value

Application|mixed

at line 134
protected array getCacheKeys()

Get all cache keys

Return Value

array

at line 149
protected string getKeyfile()

Returns a file path for hash keys

Return Value

string

at line 161
protected string|null getNamespace()

Get namespace string for cache group

Return Value

string|null

at line 171
protected int getLifetime()

Return cache life time (minute)

Return Value

int

at line 182
Model create(array $attributes = array())

Create a model object

Parameters

array $attributes attributes

Return Value

Model