belongsTo(User::class); } public function menu(): BelongsTo { return $this->belongsTo(MenuItem::class, 'menu_id'); } public static function calculateTotals($items) { $subtotal = 0; foreach ($items as $item) { $subtotal += ($item->price * $item->quantity); } return [ 'subtotal' => $subtotal, 'total' => $subtotal ]; } }