Skip to content

Instantly share code, notes, and snippets.

@naneri
Created March 19, 2015 11:28
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 naneri/b0fdbad8114bac1f7118 to your computer and use it in GitHub Desktop.
Save naneri/b0fdbad8114bac1f7118 to your computer and use it in GitHub Desktop.
setup locale
<?php
class BaseController extends Controller{
...
public function setLocale($locale = Null)
{
if(!$locale){
$mLocale = Config::get( 'app.locale' );
}
$mLocale = $locale; // Get parameter from URL.
if ( in_array( $mLocale , Config::get( 'app.locales' ) ) )
{
App::setLocale( $mLocale );
Session::put( 'locale', $mLocale );
Cookie::forever( 'locale', $mLocale );
}
return Redirect::back();
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment