sessionId = $session; } #[Computed] public function band(): object { return DB::table('session_summaries') ->where('id', $this->sessionId) ->where(function ($q) { $q->where('visibility', 'public'); if (auth()->user() !== null) { $q->orWhere(function ($own) { $own->where('visibility', 'private') ->where('user_id', auth()->id()); }); } }) ->firstOrFail(); } #[Computed] public function runs() { $band = $this->band; return BenchmarkRun::where('suite', 'scenariobench') ->where('model_id', $band->model_id) ->where('model_quant', $band->model_quant) ->where('gpu', $band->gpu) ->where('gpu_count', $band->gpu_count) ->where('user_id', $band->user_id) ->where('visibility', $band->visibility) ->where('engine', $band->engine) ->where(function ($q) use ($band) { $q->whereNull('config_id') ->orWhere('config_id', $this->configIdFromName($band->config_name)); }) ->orderBy('ran_at') ->get(); } private function configIdFromName(?string $name): ?int { if ($name === null) { return null; } return DB::table('server_configs')->where('name', $name)->value('id'); } #[Computed] public function results() { $runIds = $this->runs->pluck('id'); return DB::table('scenario_runs') ->whereIn('benchmark_run_id', $runIds) ->orderBy('scenario') ->orderBy('benchmark_run_id') ->get(); } }; ?>