当前位置: 首页>>代码示例>>PHP>>正文


PHP App::setLocale方法代码示例

本文整理汇总了PHP中App\Http\Controllers\App::setLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP App::setLocale方法的具体用法?PHP App::setLocale怎么用?PHP App::setLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Http\Controllers\App的用法示例。


在下文中一共展示了App::setLocale方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     $this->middleware('ipblocked');
     $driver = config('database.default');
     $database = config('database.connections');
     $this->db = $database[$driver]['database'];
     $this->dbuser = $database[$driver]['username'];
     $this->dbpass = $database[$driver]['password'];
     $this->dbhost = $database[$driver]['host'];
     if (\Auth::check() == true) {
         if (!\Session::get('gid')) {
             \Session::put('uid', \Auth::user()->id);
             \Session::put('gid', \Auth::user()->group_id);
             \Session::put('eid', \Auth::user()->email);
             \Session::put('ll', \Auth::user()->last_login);
             \Session::put('fid', \Auth::user()->first_name . ' ' . \Auth::user()->last_name);
             \Session::put('themes', 'sximo-light-blue');
         }
     }
     if (!\Session::get('themes')) {
         \Session::put('themes', 'sximo');
     }
     if (defined('CNF_MULTILANG') && CNF_MULTILANG == 1) {
         $lang = \Session::get('lang') != "" ? \Session::get('lang') : CNF_LANG;
         \App::setLocale($lang);
     }
     $data = array('last_activity' => strtotime(Carbon::now()));
     \DB::table('tb_users')->where('id', \Session::get('uid'))->update($data);
 }
开发者ID:Gadurp1,项目名称:Final-420-Project,代码行数:29,代码来源:Controller.php

示例2: feedback

 public function feedback()
 {
     \App::setLocale(Auth::user()->language());
     $user = Auth::user();
     $propositionFactory = new PropositionFactory();
     $viewUser = ['fullName' => $user->firstName() . " " . $user->lastName(), 'firstName' => $user->firstName(), 'lastName' => $user->lastName(), 'contactEmail' => $user->contactEmail(), 'email' => $user->email(), 'avatar' => $user->avatar(), 'belongsToSchool' => $user->belongsToSchool(), 'schoolEmail' => $user->googleEmail(), 'role' => $user->role(), 'propositionsCount' => $propositionFactory->getPropositionsCountByUser($user->userId())];
     return view('feedback', ['fullName' => $user->firstName() . " " . $user->lastName(), 'user' => $viewUser]);
 }
开发者ID:pavril,项目名称:onlinedemocracy,代码行数:8,代码来源:MainController.php

示例3: setLocale

 public function setLocale($language)
 {
     //Change language
     \Session::set('locale', $language);
     \App::setLocale($language);
     \Lang::setLocale($language);
     //
     return \Redirect::back();
 }
开发者ID:hungkhanh0709,项目名称:PhuongLoiFashion,代码行数:9,代码来源:LocaleController.php

示例4: __construct

 public function __construct()
 {
     $lang = Session::get('locale');
     if ($lang != null) {
         \App::setLocale($lang);
     }
     // $data = [];
     $styles = Style::all();
     Session::put('footerStyle', $styles);
     // view()->share('footerStyle', $styles);
 }
开发者ID:jeroenjvdb,项目名称:development-veiling,代码行数:11,代码来源:Controller.php

示例5: __construct

 /**
  * Function create construct
  */
 public function __construct()
 {
     $language = Language::where('is_default', '=', 1)->first();
     if ($language == null) {
         \App::setLocale('en');
     } else {
         \App::setLocale($language->code);
     }
     $this->getFeatureGroup();
     $d = $this->sidebar();
     $this->getNotification();
     view()->share('format_date', \App\Configure::where('name', '=', 'format_date')->first()->value);
 }
开发者ID:phanngoc,项目名称:internal-tool,代码行数:16,代码来源:AdminController.php

示例6: showPage

 public function showPage($localeCode, $slug)
 {
     // ローカルが存在しているか確認
     $locale = Locale::where('code', $localeCode)->first();
     if ($locale == null) {
         abort(404);
     }
     // 言語として設定する
     \App::setLocale($localeCode);
     // ローカルとスラグでポストが存在しているか確認
     $post = Post::with('locale')->where('slug', $slug)->where('locale_id', $locale->id)->first();
     if ($post == null) {
         abort(404);
     }
     // 記事が存在しているのでビューに渡す
     return view('page')->with('post', $post);
 }
开发者ID:HiroKws,项目名称:locale-change-sample,代码行数:17,代码来源:PageController.php

示例7: PagineRepo

 function __construct()
 {
     $pagine_repo = new PagineRepo();
     $contenuti_footer = $pagine_repo->getContentForPage('index');
     view()->share('contenuti_footer', $contenuti_footer);
     view()->share('user', \Auth()->user());
     if (\Auth::user()) {
         view()->share('user_role', array_pluck(\Auth::user()->roles()->get(), 'name')[0]);
     }
     view()->share('menu', MenuItems::all()->keyBy('slug'));
     if (Session::has('locale')) {
         $locale = Session::get('locale');
     } else {
         $locale = 'it';
     }
     \App::setLocale($locale);
     Session::put('locale', $locale);
     // dd(\App::getLocale($locale));
     view()->share('text', Config::get('traduzioni.' . $locale));
     Session::put('currentPage', '');
 }
开发者ID:sidis405,项目名称:ibi,代码行数:21,代码来源:Controller.php

示例8: __construct

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function __construct()
 {
     \App::setLocale(Auth::user()->language());
 }
开发者ID:pavril,项目名称:onlinedemocracy,代码行数:9,代码来源:ModeratorController.php

示例9: test

 public function test(Request $request)
 {
     $this->validate($request, ['name_card' => 'required']);
     App::setLocale('vi');
     return 'ok';
 }
开发者ID:JamesNguyen9x,项目名称:laravel,代码行数:6,代码来源:BookingController.php

示例10: search

 public function search(Request $request)
 {
     \App::setLocale(Auth::user()->language());
     $user = Auth::user();
     $viewUser = ['fullName' => $user->firstName() . " " . $user->lastName(), 'firstName' => $user->firstName(), 'lastName' => $user->lastName(), 'contactEmail' => $user->contactEmail(), 'email' => $user->email(), 'avatar' => $user->avatar(), 'belongsToSchool' => $user->belongsToSchool(), 'belongsToSchool' => $user->belongsToSchool(), 'schoolEmail' => $user->googleEmail(), 'role' => $user->role()];
     $results = array();
     $pages = null;
     if (empty($request->input('q')) == false) {
         $term = $request->input('q');
         $propositionFactory = new PropositionFactory();
         $proposition_results = $propositionFactory->search($term, 5);
         $pages = $proposition_results->lastPage();
         foreach ($proposition_results->items() as $proposition) {
             $proposer = with(new userFactory())->getUser($proposition->proposerId());
             $results[$proposition->propositionId()] = ['id' => $proposition->propositionId(), 'propositionSort' => $proposition->propositionSort(), 'proposer' => ['id' => $proposition->proposerId(), 'fullName' => $proposer->firstName() . " " . $proposer->lastName(), 'avatar' => $proposer->avatar()], 'propositionCreationDate' => $proposition->date_created(), 'deadline' => $proposition->deadline(), 'statusId' => $proposition->status(), 'ending_in' => Carbon::now()->diffInDays(Carbon::createFromTimestamp(strtotime($proposition->deadline())), false), 'upvotes' => $propositionFactory->getUpvotes($proposition->propositionId()), 'downvotes' => $propositionFactory->getDownvotes($proposition->propositionId()), 'comments' => $propositionFactory->getCommentsCount($proposition->propositionId()), 'marker' => $propositionFactory->getMarker($proposition->propositionId())];
         }
     }
     return view('search', ['fullName' => $user->firstName() . " " . $user->lastName(), 'user' => $viewUser, 'results' => $results, 'pages' => $pages]);
 }
开发者ID:pavril,项目名称:onlinedemocracy,代码行数:19,代码来源:PropositionsController.php

示例11: __construct

 public function __construct()
 {
     \App::setLocale(\Configer::get('lang'));
 }
开发者ID:kxgen,项目名称:facebook-anonymous-publisher,代码行数:4,代码来源:Controller.php

示例12: __construct

 public function __construct(Socialite $socialite)
 {
     $this->socialite = $socialite;
     \App::setLocale(Auth::user()->language());
 }
开发者ID:pavril,项目名称:onlinedemocracy,代码行数:5,代码来源:ProfileController.php


注:本文中的App\Http\Controllers\App::setLocale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。