class MenuItemRepository

Class MenuItemRepository

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
protected Dispatcher $dispatcher Event dispatcher instance
static protected callable $provider Menu model class provider

Methods

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

update

bool|null
delete(MenuItem $item)

Delete a menu item

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 Menu model class

static void
setModel(string $model)

Set the name of Menu 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 item

__construct(IdentifierGenerator $generator, Dispatcher $dispatcher)

MenuItemRepository constructor.

mixed
fetchIn(array $ids, string|array $with = array())

Get menu item list by primary keys

static void
setAggregator(string $aggregator)

Set aggregator to model

static void
setMenuModelProvider(callable $provider)

Set menu model class provider

static string
provideMenuModel()

Provide menu model class

Details

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

update

Parameters

Model $item item
array $data data

Return Value

Model

at line 125
bool|null delete(MenuItem $item)

Delete a menu item

Parameters

MenuItem $item menu item

Return Value

bool|null

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

at line 154
static string getModel()

The name of Menu model class

Return Value

string

at line 167
static void setModel(string $model)

Set the name of Menu 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 91
MenuItem create(array $attributes = array())

Create menu item

Parameters

array $attributes attributes

Return Value

MenuItem

at line 79
__construct(IdentifierGenerator $generator, Dispatcher $dispatcher)

MenuItemRepository constructor.

Parameters

IdentifierGenerator $generator IdentifierGenerator instance
Dispatcher $dispatcher Event dispatcher instance

at line 142
mixed fetchIn(array $ids, string|array $with = array())

Get menu item list by primary keys

Parameters

array $ids identifier list
string|array $with relation name

Return Value

mixed

at line 181
static protected void setAggregator(string $aggregator)

Set aggregator to model

Parameters

string $aggregator aggregator class

Return Value

void

at line 193
static void setMenuModelProvider(callable $provider)

Set menu model class provider

Parameters

callable $provider callable

Return Value

void

at line 203
static string provideMenuModel()

Provide menu model class

Return Value

string