Created
March 19, 2015 11:28
-
-
Save naneri/b0fdbad8114bac1f7118 to your computer and use it in GitHub Desktop.
setup locale
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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