Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * EAKKASIT TUNSAKOOL
- */
- Simple Method way to create button switch on language
- layout.blade.php
- //////////////////
- <li>{{ HTML::link('/th','th',array('id'=>'thailand','class'=>'thai')) }}</li>
- <li>{{ HTML::link('/en','en',array('id'=>'english')) }}</li>
- Routes.php
- //////////////////
- Route::get('/th',array('uses'=>'authorsController@locate'));
- Route::get('/en',array('uses'=>'authorsController@locate_en'));
- Controller
- //////////////////
- public function locate(){
- Session::put('language','th');
- App::setLocale('th');
- $view = View::make('layouts.default');
- return $view;
- }
- public function locate_en(){
- Session::put('language','en');
- App::setLocale('en');
- $view = View::make('layouts.default');
- return $view;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement