'integer', 'unit_price' => 'decimal:2', 'line_total' => 'decimal:2', 'taxable' => 'boolean', 'tax_rate' => 'decimal:2', 'tax_amount' => 'decimal:2', 'metadata' => 'array', 'created_at' => 'datetime', ]; // Relationships public function invoice(): BelongsTo { return $this->belongsTo(Invoice::class); } public function orderItem(): BelongsTo { return $this->belongsTo(OrderItem::class); } // Helpers public function calculateTax(float $rate): void { $this->tax_rate = $rate; $this->tax_amount = $this->taxable ? round($this->line_total * ($rate / 100), 2) : 0; } }