with('user', $users->get(session('uid'))); } public function locale($lang, Request $request) { if (Arr::exists(config('locales'), $lang)) { Session::set('locale', $lang); } if (isset($_SERVER['HTTP_REFERER'])) { return redirect('/')->setTargetUrl($_SERVER['HTTP_REFERER'])->withCookie('locale', $lang); } else { return redirect('/')->withCookie('locale', $lang); } } }