public function resolveRecord(): ShopProduct
{
// Get the shop_id from the import's user
$shopId = $this->getImport()->user->shop_id;
// if the quantity is not set, set it to 0
if (!isset($this->data['stock_quantity'])) {
$this->data['stock_quantity'] = 0;
}
return ShopProduct::withoutGlobalScopes()->firstOrNew([
'barcode' => $this->data['barcode'],
'shop_id' => $shopId,
]);
}
public function resolveRecord(): ShopProduct
{
// Get the shop_id from the import's user
$shopId = $this->getImport()->user->shop_id;
// if the quantity is not set, set it to 0
if (!isset($this->data['stock_quantity'])) {
$this->data['stock_quantity'] = 0;
}
return ShopProduct::withoutGlobalScopes()->firstOrNew([
'barcode' => $this->data['barcode'],
'shop_id' => $shopId,
]);
}