Свойство | Тип | Описание | |
---|---|---|---|
$cost | integer | float | string | Stores the cost for updating a stock. | |
$reason | string | Stores the reason for updating / creating a stock. |
Свойство | Тип | Описание | |
---|---|---|---|
$beforeQuantity | integer | float | string | Stores the quantity before an update. |
Метод | Описание | |
---|---|---|
add ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) | Alias for put function. | |
bootInventoryStockTrait ( ) | Overrides the models boot function to set the user ID automatically to every new record. | |
getLastMovement ( ) : boolean | |
Returns the last movement on the current stock record. | |
getMovement ( integer | string | |
Returns a movement depending on the specified argument. If an object is supplied, it is checked if it is an instance of an eloquent model. If a numeric value is entered, it is retrieved by it's ID. | |
hasEnoughStock ( integer | float | string $quantity ) : boolean | Returns true if there is enough stock for the specified quantity being taken. | |
item ( ) : |
The belongsTo item relationship. | |
location ( ) : Illuminate\Database\Eloquent\Relations\HasOne | The hasOne location relationship. | |
moveTo ( |
Moves a stock to the specified location. | |
movements ( ) : Illuminate\Database\Eloquent\Relations\HasMany | The hasMany movements relationship. | |
newTransaction ( string $name = '' ) : |
Creates and returns a new un-saved stock transaction instance with the current stock ID attached. | |
postCreate ( ) : void | Generates a stock movement after a stock is created. | |
postUpdate ( ) : void | Generates a stock movement after a stock is updated. | |
put ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) | Processes a 'put' operation on the current stock. | |
remove ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) | Removes the specified quantity from the current stock. | |
rollback ( mixed $movement = null, boolean $recursive = false ) | Rolls back the last movement, or the movement specified. If recursive is set to true, it will rollback all movements leading up to the movement specified. | |
rollbackMovement ( mixed $movement, boolean $recursive = false ) | Rolls back a specific movement. | |
take ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) | Processes a 'take' operation on the current stock. | |
transactions ( ) : Illuminate\Database\Eloquent\Relations\HasMany | The hasMany transactions relationship. | |
updateQuantity ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) | Performs a quantity update. Automatically determining depending on the quantity entered if stock is being taken or added. |
Метод | Описание | |
---|---|---|
allowDuplicateMovementsEnabled ( ) : boolean | Returns true/false from the configuration file determining whether or not stock movements can have the same before and after quantities. | |
generateStockMovement ( integer | float | string $before, integer | float | string $after, string $reason = '', integer | float | string $cost ) : boolean | |
Creates a new stock movement record. | |
getMovementById ( integer | string $id ) : null | |
Retrieves a movement by the specified ID. | |
processMoveOperation ( |
Processes the stock moving from it's current location, to the specified location. | |
processPutOperation ( integer | float | string $putting, string $reason = '', integer | float | string $cost ) | Processes adding quantity to current stock. | |
processRecursiveRollbackOperation ( |
Processes a recursive rollback operation. | |
processRollbackOperation ( |
Processes a single rollback operation. | |
processTakeOperation ( integer | float | string $taking, string $reason = '', integer | float | string $cost ) | Processes removing quantity from the current stock. | |
processUpdateQuantityOperation ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) | Processes a quantity update operation. | |
reverseCost ( ) | Reverses the cost of a movement. | |
rollbackCostEnabled ( ) : boolean | Returns true/false from the configuration file determining whether or not to rollback costs when a rollback occurs on a stock. | |
setCost ( integer | float | string $cost ) | Sets the cost attribute. | |
setReason ( string $reason = '' ) | Sets the reason attribute. |
protected allowDuplicateMovementsEnabled ( ) : boolean | ||
Результат | boolean |
public static bootInventoryStockTrait ( ) |
protected generateStockMovement ( integer | float | string $before, integer | float | string $after, string $reason = '', integer | float | string $cost ) : boolean | |
||
$before | integer | float | string | |
$after | integer | float | string | |
$reason | string | |
$cost | integer | float | string | |
Результат | boolean | |
public getLastMovement ( ) : boolean | |
||
Результат | boolean | |
abstract public item ( ) : |
||
Результат |
abstract public location ( ) : Illuminate\Database\Eloquent\Relations\HasOne | ||
Результат | Illuminate\Database\Eloquent\Relations\HasOne |
abstract public movements ( ) : Illuminate\Database\Eloquent\Relations\HasMany | ||
Результат | Illuminate\Database\Eloquent\Relations\HasMany |
public newTransaction ( string $name = '' ) : |
||
$name | string | |
Результат |
public postCreate ( ) : void | ||
Результат | void |
public postUpdate ( ) : void | ||
Результат | void |
protected processMoveOperation ( |
||
$location | ||
Результат | boolean |
protected processRecursiveRollbackOperation ( |
||
$movement | ||
Результат | array |
protected processRollbackOperation ( |
||
$movement | ||
$recursive | boolean |
protected rollbackCostEnabled ( ) : boolean | ||
Результат | boolean |
public rollbackMovement ( mixed $movement, boolean $recursive = false ) | ||
$movement | mixed | |
$recursive | boolean |
abstract public transactions ( ) : Illuminate\Database\Eloquent\Relations\HasMany | ||
Результат | Illuminate\Database\Eloquent\Relations\HasMany |
public string $reason | ||
Результат | string |