PHP Трейт Stevebauman\Inventory\Traits\AssemblyTrait

Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$assemblyCacheKey string The items assembly cache key.

Открытые методы

Метод Описание
addAssemblyItem ( Model $part, integer | float | string $quantity = 1, array $extra = [] ) Adds an item to the current assembly.
addAssemblyItems ( array $parts, integer | float | string $quantity = 1, array $extra = [] ) : integer Adds multiple parts to the current items assembly.
assemblies ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany The hasMany assemblies relationship.
assembliesRecursive ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany The belongsToMany recursive assemblies relationship.
forgetCachedAssemblyItems ( ) : boolean Removes the current items assembly items from the cache.
getAssemblyItems ( boolean $recursive = true ) : Illuminate\Database\Eloquent\Collection Returns all of the assemblies items. If recursive is true, the entire nested assemblies collection is returned.
getAssemblyItemsList ( boolean $recursive = true, integer $depth ) : array Returns all of the assemblies items in an easy to work with array.
getCachedAssemblyItems ( ) : boolean | Illuminate\Database\Eloquent\Collection Returns the current cached items assembly if it exists inside the cache. Returns false otherwise.
hasCachedAssemblyItems ( ) : boolean Returns true / false if the current item has a cached assembly.
makeAssembly ( ) Makes the current item an assembly.
removeAssemblyItem ( integer | string | Model $part ) : boolean Removes the specified part from the current items assembly.
removeAssemblyItems ( array $parts ) : integer Removes multiple parts from the current items assembly.
scopeAssembly ( Builder $query ) : mixed Scopes the current query to only retrieve inventory items that are an assembly.
updateAssemblyItem ( integer | string | Model $part, integer | float | string $quantity = 1, array $extra = [] ) Updates the inserted parts quantity for the current item's assembly.
updateAssemblyItems ( array $parts, integer | float | string $quantity, array $extra = [] ) : integer Updates multiple parts with the specified quantity.

Защищенные методы

Метод Описание
getAssemblyCacheKey ( ) : string Returns the current items assemblies cache key.
validatePart ( Model $part ) : boolean Validates that the inserted parts assembly does not contain the current item. This prevents infinite recursion.
validatePartAgainstList ( mixed $value, integer | string $key ) Validates the value and key of the values from the assemblies item list to verify that it does not equal the current items ID.

Описание методов

addAssemblyItem() публичный Метод

Adds an item to the current assembly.
public addAssemblyItem ( Model $part, integer | float | string $quantity = 1, array $extra = [] )
$part Illuminate\Database\Eloquent\Model
$quantity integer | float | string
$extra array

addAssemblyItems() публичный Метод

Adds multiple parts to the current items assembly.
public addAssemblyItems ( array $parts, integer | float | string $quantity = 1, array $extra = [] ) : integer
$parts array
$quantity integer | float | string
$extra array
Результат integer

assemblies() абстрактный публичный Метод

The hasMany assemblies relationship.
abstract public assemblies ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
Результат Illuminate\Database\Eloquent\Relations\BelongsToMany

assembliesRecursive() публичный Метод

The belongsToMany recursive assemblies relationship.
public assembliesRecursive ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
Результат Illuminate\Database\Eloquent\Relations\BelongsToMany

forgetCachedAssemblyItems() публичный Метод

Removes the current items assembly items from the cache.
public forgetCachedAssemblyItems ( ) : boolean
Результат boolean

getAssemblyCacheKey() защищенный Метод

Returns the current items assemblies cache key.
protected getAssemblyCacheKey ( ) : string
Результат string

getAssemblyItems() публичный Метод

Returns all of the assemblies items. If recursive is true, the entire nested assemblies collection is returned.
public getAssemblyItems ( boolean $recursive = true ) : Illuminate\Database\Eloquent\Collection
$recursive boolean
Результат Illuminate\Database\Eloquent\Collection

getAssemblyItemsList() публичный Метод

Returns all of the assemblies items in an easy to work with array.
public getAssemblyItemsList ( boolean $recursive = true, integer $depth ) : array
$recursive boolean
$depth integer
Результат array

getCachedAssemblyItems() публичный Метод

Returns the current cached items assembly if it exists inside the cache. Returns false otherwise.
public getCachedAssemblyItems ( ) : boolean | Illuminate\Database\Eloquent\Collection
Результат boolean | Illuminate\Database\Eloquent\Collection

hasCachedAssemblyItems() публичный Метод

Returns true / false if the current item has a cached assembly.
public hasCachedAssemblyItems ( ) : boolean
Результат boolean

makeAssembly() публичный Метод

Makes the current item an assembly.
public makeAssembly ( )

removeAssemblyItem() публичный Метод

Removes the specified part from the current items assembly.
public removeAssemblyItem ( integer | string | Model $part ) : boolean
$part integer | string | Illuminate\Database\Eloquent\Model
Результат boolean

removeAssemblyItems() публичный Метод

Removes multiple parts from the current items assembly.
public removeAssemblyItems ( array $parts ) : integer
$parts array
Результат integer

scopeAssembly() публичный Метод

Scopes the current query to only retrieve inventory items that are an assembly.
public scopeAssembly ( Builder $query ) : mixed
$query Illuminate\Database\Query\Builder
Результат mixed

updateAssemblyItem() публичный Метод

Updates the inserted parts quantity for the current item's assembly.
public updateAssemblyItem ( integer | string | Model $part, integer | float | string $quantity = 1, array $extra = [] )
$part integer | string | Illuminate\Database\Eloquent\Model
$quantity integer | float | string
$extra array

updateAssemblyItems() публичный Метод

Updates multiple parts with the specified quantity.
public updateAssemblyItems ( array $parts, integer | float | string $quantity, array $extra = [] ) : integer
$parts array
$quantity integer | float | string
$extra array
Результат integer

validatePart() защищенный Метод

Validates that the inserted parts assembly does not contain the current item. This prevents infinite recursion.
protected validatePart ( Model $part ) : boolean
$part Illuminate\Database\Eloquent\Model
Результат boolean

validatePartAgainstList() защищенный Метод

Validates the value and key of the values from the assemblies item list to verify that it does not equal the current items ID.
protected validatePartAgainstList ( mixed $value, integer | string $key )
$value mixed
$key integer | string

Описание свойств

$assemblyCacheKey защищенное свойство

The items assembly cache key.
protected string $assemblyCacheKey
Результат string