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

hold() public method

Holds the specified amount of quantity until it is either used or released.
public hold ( integer | float | string $quantity, string $reason = '', integer | float | string $cost )
$quantity integer | float | string
$reason string
$cost integer | float | string
    public function hold($quantity, $reason = '', $cost = 0)
    {
        $this->validatePreviousState([null, $this::STATE_OPENED], $this::STATE_INVENTORY_ON_HOLD);
        $this->setAttribute('quantity', $quantity);
        $this->setAttribute('state', $this::STATE_INVENTORY_ON_HOLD);
        if (empty($reason)) {
            $reason = $this->getTransactionReason('hold');
        }
        return $this->processStockTakeAndSave($quantity, 'inventory.transaction.hold', $reason, $cost);
    }