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

receivedAll() public method

Marks an order transaction as received, placing all the quantity from the transaction into the stock.
public receivedAll ( string $reason = '', integer | float | string $cost )
$reason string
$cost integer | float | string
    public function receivedAll($reason = '', $cost = 0)
    {
        /*
         * Only allow the previous state of ordered
         */
        $this->validatePreviousState([$this::STATE_ORDERED_PENDING], $this::STATE_ORDERED_RECEIVED);
        $received = $this->getAttribute('quantity');
        $this->setAttribute('quantity', 0);
        $this->setAttribute('state', $this::STATE_ORDERED_RECEIVED);
        if (empty($reason)) {
            $reason = $this->getTransactionReason('received');
        }
        return $this->processStockPutAndSave($received, 'inventory.transaction.received', $reason, $cost);
    }