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

Наследование: use trait CommonMethodsTrait
Показать файл Открыть проект

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

Метод Описание
addToLocation ( integer | float | string $quantity, Model $location, string $reason = '', integer | float | string $cost ) : array Alias for the put function.
addToManyLocations ( integer | float | string $quantity, array $locations = [], string $reason = '', integer | float | string $cost ) : array Alias for the putToMany function.
bootInventoryTrait ( ) Overrides the models boot function to set the user ID automatically to every new record.
category ( ) : Illuminate\Database\Eloquent\Relations\HasOne The hasOne category relationship.
createSku ( string $code, boolean $overwrite = false ) : mixed | boolean Creates an SKU with the specified code. If overwrite is true, the current items SKU will be deleted if it exists before creating then SKU. If overwrite is false but the item has an SKU, an exception is thrown.
createStockOnLocation ( integer | float | string $quantity, Model $location, string $reason = '', integer | float | string $cost, string $aisle = null, string $row = null, string $bin = null ) : Model Creates a stock record to the current inventory item.
findBySku ( string $sku ) : boolean Returns an item record by the specified SKU code.
generateSku ( ) : boolean | mixed Generates an item SKU record.
getMetricSymbol ( ) : string | null Returns the inventory's metric symbol.
getSku ( ) : null | string Returns the item's SKU.
getSkuCodeAttribute ( ) : null | string Laravel accessor for the current items SKU.
getStockFromLocation ( Model $location ) : mixed Retrieves an inventory stock from a given location.
getTotalStock ( ) : integer | float Returns the total sum of the current item stock.
hasCategory ( ) : boolean Returns true/false if the current item has a category.
hasMetric ( ) : boolean Returns true/false if the inventory has a metric present.
hasSku ( ) : boolean Returns true/false if the current item has an SKU.
isInStock ( ) : boolean Returns true/false if the inventory has stock.
metric ( ) : Illuminate\Database\Eloquent\Relations\HasOne The hasOne metric relationship.
moveStock ( Model $fromLocation, Model $toLocation ) : mixed Moves a stock from one location to another.
newStockOnLocation ( Model $location ) : Model Instantiates a new stock on the specified location on the current item.
putToLocation ( integer | float | string $quantity, Model $location, string $reason = '', integer | float | string $cost ) : array Puts the specified amount ($quantity) of stock into the specified stock location.
putToManyLocations ( integer | float | string $quantity, array $locations = [], string $reason = '', integer | float | string $cost ) : array Puts the specified amount ($quantity) of stock into the specified stock locations.
regenerateSku ( ) : boolean | mixed Regenerates the current items SKU by deleting its current SKU and creating another. This will also generate an SKU if one does not exist.
removeFromLocation ( integer | float | string $quantity, $location, string $reason = '' ) : array Alias for the take function.
removeFromManyLocations ( integer | float | string $quantity, array $locations = [], string $reason = '' ) : array Alias for the takeFromMany function.
sku ( ) : Illuminate\Database\Eloquent\Relations\HasOne The hasOne SKU relationship.
stocks ( ) : Illuminate\Database\Eloquent\Relations\HasMany The hasMany stocks relationship.
suppliers ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany The belongsToMany suppliers relationship.
takeFromLocation ( integer | float | string $quantity, Model $location, string $reason = '' ) : array Takes the specified amount ($quantity) of stock from specified stock location.
takeFromManyLocations ( integer | float | string $quantity, array $locations = [], string $reason = '' ) : array Takes the specified amount ($quantity) of stock from the specified stock locations.
updateSku ( string $code, null $sku = null ) : mixed | boolean Updates the items current SKU or the SKU supplied with the specified code.

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

Метод Описание
processSkuGeneration ( integer | string $inventoryId, string $code ) : boolean | mixed Processes an SKU generation covered by database transactions.
processSkuUpdate ( Model $sku, string $code ) : mixed | boolean Processes updating the specified SKU record with the specified code.
skusEnabled ( ) : mixed Returns the configuration option for the enablement of automatic SKU generation.

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

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

Alias for the put function.
public addToLocation ( integer | float | string $quantity, Model $location, string $reason = '', integer | float | string $cost ) : array
$quantity integer | float | string
$location Illuminate\Database\Eloquent\Model
$reason string
$cost integer | float | string
Результат array

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

Alias for the putToMany function.
public addToManyLocations ( integer | float | string $quantity, array $locations = [], string $reason = '', integer | float | string $cost ) : array
$quantity integer | float | string
$locations array
$reason string
$cost integer | float | string
Результат array

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

Overrides the models boot function to set the user ID automatically to every new record.
public static bootInventoryTrait ( )

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

The hasOne category relationship.
abstract public category ( ) : Illuminate\Database\Eloquent\Relations\HasOne
Результат Illuminate\Database\Eloquent\Relations\HasOne

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

Creates an SKU with the specified code. If overwrite is true, the current items SKU will be deleted if it exists before creating then SKU. If overwrite is false but the item has an SKU, an exception is thrown.
public createSku ( string $code, boolean $overwrite = false ) : mixed | boolean
$code string
$overwrite boolean
Результат mixed | boolean

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

Creates a stock record to the current inventory item.
public createStockOnLocation ( integer | float | string $quantity, Model $location, string $reason = '', integer | float | string $cost, string $aisle = null, string $row = null, string $bin = null ) : Model
$quantity integer | float | string
$location Illuminate\Database\Eloquent\Model
$reason string
$cost integer | float | string
$aisle string
$row string
$bin string
Результат Illuminate\Database\Eloquent\Model

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

Returns an item record by the specified SKU code.
public static findBySku ( string $sku ) : boolean
$sku string
Результат boolean

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

If an item already has an SKU, the SKU record will be returned. If an item does not have a category, it will return false.
public generateSku ( ) : boolean | mixed
Результат boolean | mixed

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

Returns the inventory's metric symbol.
public getMetricSymbol ( ) : string | null
Результат string | null

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

Returns the item's SKU.
public getSku ( ) : null | string
Результат null | string

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

Laravel accessor for the current items SKU.
public getSkuCodeAttribute ( ) : null | string
Результат null | string

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

Retrieves an inventory stock from a given location.
public getStockFromLocation ( Model $location ) : mixed
$location Illuminate\Database\Eloquent\Model
Результат mixed

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

Returns the total sum of the current item stock.
public getTotalStock ( ) : integer | float
Результат integer | float

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

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

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

Returns true/false if the inventory has a metric present.
public hasMetric ( ) : boolean
Результат boolean

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

Returns true/false if the current item has an SKU.
public hasSku ( ) : boolean
Результат boolean

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

Returns true/false if the inventory has stock.
public isInStock ( ) : boolean
Результат boolean

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

The hasOne metric relationship.
abstract public metric ( ) : Illuminate\Database\Eloquent\Relations\HasOne
Результат Illuminate\Database\Eloquent\Relations\HasOne

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

Moves a stock from one location to another.
public moveStock ( Model $fromLocation, Model $toLocation ) : mixed
$fromLocation Illuminate\Database\Eloquent\Model
$toLocation Illuminate\Database\Eloquent\Model
Результат mixed

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

Instantiates a new stock on the specified location on the current item.
public newStockOnLocation ( Model $location ) : Model
$location Illuminate\Database\Eloquent\Model
Результат Illuminate\Database\Eloquent\Model

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

Processes an SKU generation covered by database transactions.
protected processSkuGeneration ( integer | string $inventoryId, string $code ) : boolean | mixed
$inventoryId integer | string
$code string
Результат boolean | mixed

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

Processes updating the specified SKU record with the specified code.
protected processSkuUpdate ( Model $sku, string $code ) : mixed | boolean
$sku Illuminate\Database\Eloquent\Model
$code string
Результат mixed | boolean

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

Puts the specified amount ($quantity) of stock into the specified stock location.
public putToLocation ( integer | float | string $quantity, Model $location, string $reason = '', integer | float | string $cost ) : array
$quantity integer | float | string
$location Illuminate\Database\Eloquent\Model
$reason string
$cost integer | float | string
Результат array

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

Puts the specified amount ($quantity) of stock into the specified stock locations.
public putToManyLocations ( integer | float | string $quantity, array $locations = [], string $reason = '', integer | float | string $cost ) : array
$quantity integer | float | string
$locations array
$reason string
$cost integer | float | string
Результат array

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

Regenerates the current items SKU by deleting its current SKU and creating another. This will also generate an SKU if one does not exist.
public regenerateSku ( ) : boolean | mixed
Результат boolean | mixed

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

Alias for the take function.
public removeFromLocation ( integer | float | string $quantity, $location, string $reason = '' ) : array
$quantity integer | float | string
$location
$reason string
Результат array

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

Alias for the takeFromMany function.
public removeFromManyLocations ( integer | float | string $quantity, array $locations = [], string $reason = '' ) : array
$quantity integer | float | string
$locations array
$reason string
Результат array

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

The hasOne SKU relationship.
abstract public sku ( ) : Illuminate\Database\Eloquent\Relations\HasOne
Результат Illuminate\Database\Eloquent\Relations\HasOne

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

Returns the configuration option for the enablement of automatic SKU generation.
protected skusEnabled ( ) : mixed
Результат mixed

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

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

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

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

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

Takes the specified amount ($quantity) of stock from specified stock location.
public takeFromLocation ( integer | float | string $quantity, Model $location, string $reason = '' ) : array
$quantity integer | float | string
$location Illuminate\Database\Eloquent\Model
$reason string
Результат array

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

Takes the specified amount ($quantity) of stock from the specified stock locations.
public takeFromManyLocations ( integer | float | string $quantity, array $locations = [], string $reason = '' ) : array
$quantity integer | float | string
$locations array
$reason string
Результат array

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

Updates the items current SKU or the SKU supplied with the specified code.
public updateSku ( string $code, null $sku = null ) : mixed | boolean
$code string
$sku null
Результат mixed | boolean