public function setLang($request)
    {
        if (Auth::check()) {
            $user = Auth::user();

            // Set user locale
            if ($user->locale) {
                $this->setIfAllowed($user->locale);
            } else {
                if (config('localizer.set_auto_lang')) {
                    $this->setIfAllowed(Identify::lang()->getLanguage());
                } else {
                    $this->setIfAllowed(config('localizer.default_lang'));
                }
            }
        } else {
            if ($request->session()->has('locale')) {
                $this->setIfAllowed(session('locale'));
            } else {
                if (config('localizer.set_auto_lang')) {
                    $this->setIfAllowed(Identify::lang()->getLanguage());
                } else {
                    $this->setIfAllowed(config('localizer.default_lang'));
                }
            }
        }
    }