src/Http/Controllers/LocaleController.php
public function setLocale(SetLocaleRequest $request)
    {
        $locale = $request->input('locale');

        if ( ! $this->repository->isAvailable($locale)) {
            return redirect()->back()->withErrors("Locale {$locale} is not available");
        }

        session()->put($this->getSessionKey(), $locale);

        return redirect()->back();
    }
public function setLocale(SetLocaleRequest $request)
    {
        $locale = $request->input('locale');

        if ( ! $this->repository->isAvailable($locale)) {
            return redirect()->back()->withErrors("Locale {$locale} is not available");
        }

        session()->put($this->getSessionKey(), $locale);

        return redirect()->back();
    }
public function setLocale ( SetLocaleRequest $ request ) { $ locale = $ request -> input ( 'locale' ) ; if ( ! $ this -> repository -> isAvailable ( $ locale ) ) { return redirect ( ) -> back ( ) -> withErrors ( "Locale {$locale} is not available" ) ; } session ( ) -> put ( $ this -> getSessionKey ( ) , $ locale ) ; return redirect ( ) -> back ( ) ; }
Sets and stores the locale in the session.

@param SetLocaleRequest $request
@return mixed
Sets and stores the locale in the session .