id = $snapshot['id'] ?? 0; $this->name = $snapshot['name'] ?? ''; $this->selling_price = $snapshot['selling_price'] ?? 0; $this->tax_status = isset($snapshot['tax_status']) ? ProductTaxStatus::tryFrom($snapshot['tax_status']) : ProductTaxStatus::TAXABLE; $this->tax_rate = $snapshot['tax_rate'] ?? null; $this->shipping_policy_id = $shippingPolicyId; $this->categories = collect([]); } /** * 다국어 상품명을 반환합니다. * * @return string 스냅샷에 저장된 상품명 */ public function getLocalizedName(): string { if (is_array($this->name)) { return $this->name[app()->getLocale()] ?? $this->name['ko'] ?? reset($this->name) ?: ''; } return $this->name; } /** * relation 로드 여부 확인 (스냅샷에서는 항상 false) * * @param string $relation 관계명 * @return bool */ public function relationLoaded(string $relation): bool { return false; } }