Stevebauman\Inventory\Traits\InventoryTrait::updateSku PHP Метод

updateSku() публичный Метод

Updates the items current SKU or the SKU supplied with the specified code.
public updateSku ( string $code, null $sku = null ) : mixed | boolean
$code string
$sku null
Результат mixed | boolean
    public function updateSku($code, $sku = null)
    {
        // Get the current SKU record if one isn't supplied
        if (!$sku) {
            $sku = $this->sku()->first();
        }
        /*
         * If an SKU still doesn't exist after
         * trying to find one, we'll create one
         */
        if (!$sku) {
            return $this->processSkuGeneration($this->getKey(), $code);
        }
        return $this->processSkuUpdate($sku, $code);
    }