本文整理汇总了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);
}
示例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]);
}
示例3: setLocale
public function setLocale($language)
{
//Change language
\Session::set('locale', $language);
\App::setLocale($language);
\Lang::setLocale($language);
//
return \Redirect::back();
}
示例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);
}
示例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);
}
示例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);
}
示例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', '');
}
示例8: __construct
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function __construct()
{
\App::setLocale(Auth::user()->language());
}
示例9: test
public function test(Request $request)
{
$this->validate($request, ['name_card' => 'required']);
App::setLocale('vi');
return 'ok';
}
示例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]);
}
示例11: __construct
public function __construct()
{
\App::setLocale(\Configer::get('lang'));
}
示例12: __construct
public function __construct(Socialite $socialite)
{
$this->socialite = $socialite;
\App::setLocale(Auth::user()->language());
}