cookie('sessionKey'))->first(); $pro = $session ? $session->pro() : null; $client = !empty($uid) ? Client::where('uid', $uid)->first() : null; return view('app.video.call', compact('session', 'pro', 'client')); } // ajax ep used by the video page // this is needed bcoz meet() is used not // just for the client passed to the view public function getOpentokSessionKey(Request $request, $uid) { $client = Client::where('uid', $uid)->first(); return json_encode(["data" => $client ? $client->opentok_session_id : '']); } }