Stevebauman\Inventory\Traits\InventoryTransactionTrait::returned PHP Method

returned() public method

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.
public returned ( integer | float | string $quantity, string $reason = '', integer | float | string $cost )
$quantity integer | float | string
$reason string
$cost integer | float | string
    public function returned($quantity = 0, $reason = '', $cost = 0)
    {
        if ($quantity) {
            /*
             * Quantity was specified, we must be
             * returning a partial amount of quantity
             */
            return $this->returnedPartial($quantity, $reason, $cost);
        } else {
            /*
             * Looks like we're returning all of the stock
             */
            return $this->returnedAll($reason, $cost);
        }
    }