Skip to content

Instantly share code, notes, and snippets.

@escuccim
Created January 10, 2017 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save escuccim/da27655b26e5128165d44379f1b7e608 to your computer and use it in GitHub Desktop.
Save escuccim/da27655b26e5128165d44379f1b7e608 to your computer and use it in GitHub Desktop.
Laravel Helper to set language from session
function setLanguage(){
// set the app locale
App::setLocale( session('locale') ? session('locale') : config('app.locale'));
// set PHP locale for formatting dates
if(App::getLocale() == 'fr')
setlocale(LC_TIME, 'fr_CH.UTF-8');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment