Method |
Description |
|
backOrder ( integer | float | string $quantity ) |
Back-orders the specified amount of quantity on the stock, if stock is sufficient enough
for the quantity specified, this will throw an exception. This prevents back-orders
being created when unnecessary. |
|
bootInventoryTransactionTrait ( ) : void |
Overrides the models boot function to generate a new transaction history
record when it is created and updated. |
|
cancel ( string $reason = '', integer | float | string $cost ) |
Cancels any transaction and returns or removes stock depending on the last state. |
|
checkout ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Checks out the specified amount of quantity from the stock,
waiting to be sold. |
|
fillBackOrder ( string $reason = '', integer | float | string $cost ) |
Fills a back order by trying to remove the transaction quantity
from the stock. This will return false if there was not enough stock
to fill the back order, or an exception occurred. |
|
getByState ( string $state ) : Illuminate\Database\Eloquent\Collection |
Returns all transactions by the specified state. |
|
getHistory ( ) : mixed |
Returns the current transaction history. |
|
getLastHistoryRecord ( ) : boolean | mixed |
Returns the last transaction history record. |
|
getStockRecord ( ) : mixed |
Returns the current stock record
attached to the current transaction. |
|
hasStock ( ) : boolean |
Returns true/false depending if the current
transaction is attached to a stock. |
|
histories ( ) : Illuminate\Database\Eloquent\Relations\HasMany |
The hasMany histories relationship. |
|
hold ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Holds the specified amount of quantity until
it is either used or released. |
|
isBackOrder ( ) : boolean |
Returns true or false depending if the
current state of the transaction is a back order. |
|
isCancelled ( ) : boolean |
Returns true or false depending if the
current state of the transaction is cancelled. |
|
isCheckout ( ) : boolean |
Returns true or false depending if the
current state of the transaction is a checkout. |
|
isOnHold ( ) : boolean |
Returns true or false depending if the
current state of the transaction is on-hold. |
|
isOrder ( ) : boolean |
Returns true or false depending if the
current state of the transaction is an order. |
|
isOrderReceived ( ) : boolean |
Returns true or false depending if the
current state of the transaction is a received order. |
|
isReleased ( ) : boolean |
Returns true or false depending if the
current state of the transaction is released inventory. |
|
isRemoved ( ) : boolean |
Returns true or false depending if the
current state of the transaction is removed inventory. |
|
isReservation ( ) : boolean |
Returns true or false depending if the
current state of the transaction is reserved. |
|
isReturn ( ) : boolean |
Returns true or false depending if the
current state of the transaction is a return. |
|
isSold ( ) : boolean |
Returns true or false depending if the
current state of the transaction is sold. |
|
ordered ( integer | float | string $quantity ) |
Creates a transaction that specifies the amount of quantity that has been ordered. |
|
postCreate ( ) |
Generates a transaction history record after a transaction has been created. |
|
postUpdate ( ) |
Generates a transaction history record when a transaction has been updated. |
|
received ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Marks a transaction as received. If the previous state was ordered then the amount
ordered is inserted into the stock. If a quantity is specified then the status of the
transaction is set to received-partial, and then returned to ordered with the amount of
quantity left to receive. |
|
receivedAll ( string $reason = '', integer | float | string $cost ) |
Marks an order transaction as received, placing all the quantity from
the transaction into the stock. |
|
receivedPartial ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Marks an order transaction as received-partial, placing
the specified quantity into the stock and returning the
transaction to the previous ordered state with the remaining stock
to receive. |
|
release ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Releases held inventory and inserts it back into the stock. If a quantity is specified
and it is lower than the held quantity, than the transaction state will change to
released-partial and then returned to the state on-hold with the remainder of the
held stock. |
|
releaseAll ( string $reason = '', integer | float | string $cost ) |
Releases an on-hold inventory transaction, placing all the quantity
in the transaction back into the stock. |
|
releasePartial ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Releases a partial amount of the specified quantity from the transaction
and returns it to the previous state. |
|
remove ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Removes the specified quantity from the stock for the current transaction. |
|
removeAll ( ) |
Permanently removes all of the transaction quantity from the stock. Since
the stock was already removed with the on-hold method, the removed state
is an 'end of the line' state, and cannot be recovered or reversed. |
|
removePartial ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Removes a partial amount of quantity from the inventory. If the transactions
previous state was on-hold, no inventory will be removed since the stock
was already taken. If the previous state is null or opened, then it will
remove the specified quantity from the stock. |
|
reserved ( integer | float | string $quantity, boolean $backOrder = false, string $reason = '', integer | float | string $cost ) |
Reserves the specified amount of quantity for a reservation for commerce. |
|
returned ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Returns the specified amount of quantity back into the stock. A previous
state is required to successfully insert the quantity back into the stock, for
example, if the stock was sold, or was in checkout, the returned method could
be called and the quantity that was sold or was in checkout would be inserted
back into the stock. If a quantity is specified and it is less than the amount
that was sold/checked-out, then the specified amount is inserted back into the stock
and the transaction is reverted to its previous state with the leftover amount. |
|
returnedAll ( string $reason = '', integer | float | string $cost ) |
Marks a transaction as returned and places the stock that
was taken back into the inventory. |
|
returnedPartial ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Marks a transaction as partially returned and returns the specified quantity
back into the stock. If the transaction quantity is greater or equal to the specified
quantity then a full return is processed. |
|
setQuantityAttribute ( integer | float | string $quantity ) |
Validates the quantity attribute
when it has been set. |
|
setStateAttribute ( string $state ) |
Verifies if the state being set is valid. |
|
sold ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Marks and removes the specified amount of quantity sold from the stock. |
|
soldAmount ( integer | float | string $quantity, string $reason = '', integer | float | string $cost ) |
Marks a new or open transaction as sold and removes the amount
of the specified quantity from from the inventory stock. |
|
stock ( ) : BelongsTo |
The belongsTo stock relationship. |
|