Server IP : 66.29.132.124 / Your IP : 18.224.44.233 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/modules/Language/Controllers/ |
Upload File : |
<?php /** * Created by PhpStorm. * User: h2 gaming * Date: 7/3/2019 * Time: 11:45 PM */ namespace Modules\Language\Controllers; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Cookie; use Modules\FrontendController; use Modules\Language\Models\Language; class LanguageController extends FrontendController { public function setLang(\Illuminate\Http\Request $request,$locale){ $oldLocale = \App::getLocale(); $path = $request->query('path'); $this->setLocale($locale, $request); if(empty($path)){ return redirect('/'); } if(strpos($path,$oldLocale) === 0){ return redirect(str_replace($oldLocale,$locale,$path)); } return redirect($locale.'/'.$path); } public function setAdminLang(\Illuminate\Http\Request $request,$locale){ Cookie::queue('bc_admin_locale', $locale, 60*24*365);// one year return redirect()->back(); } private function setLocale($locale, $request) { $lang = Language::where('locale',$locale)->first(); if(empty($lang)){ $locale = setting_item('site_locale'); } $request->session()->put('website_locale', $locale); // // return redirect(add_query_arg([ // 'set_lang'=> // ])) } }