'decimal:4', 'calculated_quantity' => 'decimal:4', 'unit_price' => 'decimal:2', 'total_price' => 'decimal:2', 'delivery_date' => 'date', 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; /** * 견적 마스터 */ public function quote(): BelongsTo { return $this->belongsTo(Quote::class); } /** * 금액 계산 (수량 × 단가) */ public function calculateTotalPrice(): float { return round($this->calculated_quantity * $this->unit_price, 2); } /** * 금액 업데이트 후 저장 */ public function updateTotalPrice(): self { $this->total_price = $this->calculateTotalPrice(); return $this; } }