orderItems->sum(fn ($item) => $item->unit_price * $item->quantity); } public function getTotal() { return $this->orderItems->sum(fn ($item) => $item->unit_price * $item->quantity - $item->discount); } }