wordpress related posts

Laravel 5.2 Language Switcher – Tutorial

Posted On August 24, 2019 at 7:40 pm by / No Comments



////////make laravel project////////
composer make-project –prefer-dist laravel/laravel blog
////////// middleware code/////////////////////
App::setLocale(Session::has(‘locale’) ? Session::get(‘locale’) : Config::get(‘app.locale’));
//////////// controller code////////////////////
if(!Session::has(‘locale’))

Session::place(‘locale’, Input::get(‘locale’));
else
Session::set(‘locale’, Input::get(‘locale’));

return Redirect::back();
////////////////////form///////////
csrf_field()
//////////////////////
trans(‘file.string’)
///////////////////////
App::getLocale() == ‘en’ ? ‘ selected’ : ”

source

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate ยป