id || !$lobby->is_stranger_accessible) { \abort(404); return; } $sessionKey = Cookie::get('sessionKey'); $lobbyModel = new ClientLobbyModel($lobby); session([ 'lobbyId' => $lobby->id ]); // $response = response()->view('client/index',compact('lobbyModel'),200); if(!$sessionKey){ $loginUrl = env('BACKEND_URL', 'http://localhost:8080') . '/api/session/createStrangerSession'; $httpResponse = Http::asForm()->post($loginUrl)->json(); if(!$httpResponse['success']){ return back()->with("message", $httpResponse['message']); } $sessionKey = $httpResponse['data']; // $cookie = cookie()->forever('sessionKey', $sessionKey, '/'); cookie()->queue('sessionKey', $sessionKey, 1440, '/'); // $response = new \Illuminate\Http\Response(view('client/index')); // $response->withCookie($cookie); // return $response; } // else { // return view('client/index'); // } return view('client/index',compact('lobbyModel','sessionKey')); } public function meeting(MeetingParticipant $meetingParticipant) { $sessionKey = Cookie::get('sessionKey'); if (!$meetingParticipant || !$meetingParticipant->id || !session('lobbyId')) { \abort(404); return; } $lobby = Lobby::find(session('lobbyId')); $lobbyModel = new ClientLobbyModel($lobby); $session = AppSession::where("session_key",$sessionKey)->first(); $meeting = null; if ($session->meetingParticipant // && $session->meetingParticipant->is_active && $session->meetingParticipant->meeting->is_active && ($session->meetingParticipant->meeting->lobby_id === $lobby->id || $session->meetingParticipant->meeting->lobby_id == null) ) { $meeting = new MeetingModel($session->meetingParticipant->meeting); } else { \abort(404); return; } return view('client/meeting',compact('lobbyModel','meeting','sessionKey')); } }