input('session_name'); $session = GameSession::create(['session_name' => $sessionName]); return response()->json($session); } public function end(Request $request) { $sessionId = $request->input('session_id'); $session = GameSession::find($sessionId); if ($session) { $session->update(['ended_at' => now()]); return response()->json($session); } return response()->json(['error' => 'Session not found'], 404); } public function current() { $session = GameSession::whereNull('ended_at')->latest()->first(); return response()->json($session); } }