class MenuRepository

Class MenuRepository

Traits

Constants

DUPLICATE_RETRY_CNT

Limit count of retry for ID duplicated

Properties

static protected array $models model class name from EloquentRepositoryTrait
protected string $namespace Namespace for cache
protected IdentifierGenerator $generator IdentifierGenerator instance

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)

create(array $attributes = array())

Create menu

__construct(IdentifierGenerator $generator)

MenuRepository constructor.

mixed
findWith(string $id, string|array $with = array())

Find a menu by its primary key. and with relations

mixed
fetchBySiteKey(string $siteKey, string|array $with = array())

Get menu list by site keyword. and with relations

Details

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

update

Parameters

Model $item item
array $data data

Return Value

Model

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

mixed __call(string $name, array $arguments)

__call

Parameters

string $name method name
array $arguments arguments

Return Value

mixed

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

protected void storeCacheKey(string $class, string $cacheKey)

Store cache key

Parameters

string $class class name
string $cacheKey cache key

Return Value

void

protected void clearCache()

Remove all cache data

Return Value

void

protected string makeHash(array $args)

Make hash string

Parameters

array $args arguments

Return Value

string

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

Resolve a service instance

Parameters

string|null $service service name

Return Value

Application|mixed

protected array getCacheKeys()

Get all cache keys

Return Value

array

protected string getKeyfile()

Returns a file path for hash keys

Return Value

string

protected string|null getNamespace()

Get namespace string for cache group

Return Value

string|null

protected int getLifetime()

Return cache life time (minute)

Return Value

int

at line 72
Menu create(array $attributes = array())

Create menu

Parameters

array $attributes attributes

Return Value

Menu

at line 61
__construct(IdentifierGenerator $generator)

MenuRepository constructor.

Parameters

IdentifierGenerator $generator IdentifierGenerator instance

at line 103
mixed findWith(string $id, string|array $with = array())

Find a menu by its primary key. and with relations

Parameters

string $id identifier
string|array $with relation name

Return Value

mixed

at line 117
mixed fetchBySiteKey(string $siteKey, string|array $with = array())

Get menu list by site keyword. and with relations

Parameters

string $siteKey site key
string|array $with relation name

Return Value

mixed