user(); $hash = Str::random(64); $data = [ 'user_id' => $user->id, 'company_key' => $user->company()->company_key, 'context' => $request->input('context'), 'is_react' => $request->hasHeader('X-REACT') ? true : false, ]; Cache::put($hash, $data, 3600); return response()->json(['hash' => $hash], 200); } public function router(OneTimeRouterRequest $request) { $data = Cache::get($request->input('hash')); MultiDB::findAndSetDbByCompanyKey($data['company_key']); $this->sendTo($data['context']); } /* We need to merge all contexts here and redirect to the correct location */ private function sendTo($context) { return redirect(); } }