PHP Trait Stevebauman\Inventory\Traits\AssemblyTrait

Afficher le fichier Open project: stevebauman/inventory

Protected Properties

Свойство Type Description
$assemblyCacheKey string The items assembly cache key.

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Method Details

addAssemblyItem() public méthode

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() public méthode

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
Résultat integer

assemblies() abstract public méthode

The hasMany assemblies relationship.
abstract public assemblies ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
Résultat Illuminate\Database\Eloquent\Relations\BelongsToMany

assembliesRecursive() public méthode

The belongsToMany recursive assemblies relationship.
public assembliesRecursive ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
Résultat Illuminate\Database\Eloquent\Relations\BelongsToMany

forgetCachedAssemblyItems() public méthode

Removes the current items assembly items from the cache.
public forgetCachedAssemblyItems ( ) : boolean
Résultat boolean

getAssemblyCacheKey() protected méthode

Returns the current items assemblies cache key.
protected getAssemblyCacheKey ( ) : string
Résultat string

getAssemblyItems() public méthode

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
Résultat Illuminate\Database\Eloquent\Collection

getAssemblyItemsList() public méthode

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
Résultat array

getCachedAssemblyItems() public méthode

Returns the current cached items assembly if it exists inside the cache. Returns false otherwise.
public getCachedAssemblyItems ( ) : boolean | Illuminate\Database\Eloquent\Collection
Résultat boolean | Illuminate\Database\Eloquent\Collection

hasCachedAssemblyItems() public méthode

Returns true / false if the current item has a cached assembly.
public hasCachedAssemblyItems ( ) : boolean
Résultat boolean

makeAssembly() public méthode

Makes the current item an assembly.
public makeAssembly ( )

removeAssemblyItem() public méthode

Removes the specified part from the current items assembly.
public removeAssemblyItem ( integer | string | Model $part ) : boolean
$part integer | string | Illuminate\Database\Eloquent\Model
Résultat boolean

removeAssemblyItems() public méthode

Removes multiple parts from the current items assembly.
public removeAssemblyItems ( array $parts ) : integer
$parts array
Résultat integer

scopeAssembly() public méthode

Scopes the current query to only retrieve inventory items that are an assembly.
public scopeAssembly ( Builder $query ) : mixed
$query Illuminate\Database\Query\Builder
Résultat mixed

updateAssemblyItem() public méthode

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() public méthode

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
Résultat integer

validatePart() protected méthode

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
Résultat boolean

validatePartAgainstList() protected méthode

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

Property Details

$assemblyCacheKey protected_oe property

The items assembly cache key.
protected string $assemblyCacheKey
Résultat string