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


PHP Date::setLocale方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     Date::setLocale('th');
     $user = Auth::user();
     $jobapps = Jobapp::all();
     return view('hr.jobapps.index', compact('jobapps', 'user'));
 }
开发者ID:kokzilla,项目名称:ipms2,代码行数:12,代码来源:JobappsController.php

示例2: home

 public function home()
 {
     $page_title = "لوحة التحكم";
     $section_title = "لوحة التحكم";
     Date::setLocale('ar');
     $date = Date::now()->format('j F Y');
     $day = Date::now()->format('l');
     $month = Date::now()->format('F');
     $year = Date::now()->format('Y');
     //**************Tasks***************
     $tasksToday = Task::orderBy('task_date', 'desc')->today()->take(5);
     $tasksWeek = Task::orderBy('task_date', 'desc')->thisweek()->take(5);
     $tasksMonth = Task::orderBy('task_date', 'desc')->thisMonth()->take(5);
     $tasks_count = count($tasksToday->toArray());
     //**************Fails***************
     $failsToday = Failure::orderBy('fail_time', 'desc')->today()->take(5);
     $failsWeek = Failure::orderBy('fail_time', 'desc')->thisweek()->take(5);
     $failsMonth = Failure::orderBy('fail_time', 'desc')->thisMonth()->take(5);
     $fails_count = count($failsToday->toArray());
     //**************Repairs***************
     $repairsToday = Repair::today();
     $repairsWeek = Repair::thisweek();
     $repairsMonth = Repair::thisMonth();
     $repairs_count = count($repairsToday->toArray());
     return view('dashboard.dashboard', compact('page_title', 'section_title', 'date', 'day', 'month', 'year', 'tasksToday', 'tasksMonth', 'tasksWeek', 'tasks_count', 'failsToday', 'failsMonth', 'failsWeek', 'fails_count', 'repairsToday', 'repairsMonth', 'repairsWeek', 'repairs_count'));
 }
开发者ID:ashraf2033,项目名称:maintainit,代码行数:26,代码来源:PagesController.php

示例3: getHome

 public function getHome()
 {
     Date::setLocale('id');
     $date = Date::now();
     $pikets = \DB::table('t_piket')->where('hari', $date->format('l'))->first();
     $piket = \DB::table('t_guru')->where('kd_guru', $pikets->kd_guru)->first();
     $jam_masuk = Date::createFromFormat('H:i:s', $pikets->jam_masuk, Date::now()->tzName)->toTimeString();
     return view('home', compact('jam_masuk'));
 }
开发者ID:rizkidoank,项目名称:smansa-absensi,代码行数:9,代码来源:AbsencesController.php

示例4: home

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function home()
 {
     $lastNews = News::orderBy('id', 'desc')->first();
     $lastNews->description = $this::text_humanized($lastNews->description);
     Date::setLocale('fr');
     $date = new Date($lastNews->when);
     $lastNews->when = $date->format('l j F Y');
     $lastNews->hour = $date->format('H:i');
     return view('page/home', ['news' => $lastNews]);
 }
开发者ID:AxelCardinaels,项目名称:CbSeraing-Laravel,代码行数:15,代码来源:PagesController.php

示例5: build

 public function build()
 {
     $translator = $this->processor->getTranslator();
     $html = "";
     Date::setLocale($this->locale);
     if ($this->printStyles) {
         $html .= $this->getStylesHtml();
     }
     $hidden = $this->isModal ? ' style="display:none;"' : '';
     if ($this->printFrame) {
         $html .= '<div id="changemodal-wrapper"' . $hidden . '><div id="changemodal"' . $hidden . '><div id="changemodal-frame"><h1>' . $this->title . '</h1>';
         if ($this->isModal) {
             $html .= '<i id="close-button" class="fa fa-times"></i>';
         }
     } else {
         $html .= '<div id="changemodal">';
     }
     $html .= '<div class="changelog">';
     try {
         foreach ($this->processor->getVersions() as $version) {
             $html .= '<h2 id="' . $version->getVersion() . '"';
             if ($version->isYanked()) {
                 $html .= ' class="yanked" title="' . $translator->translateTo('This release has been yanked.') . '"';
             }
             $html .= '>' . $version->getVersion() . '</h2>';
             if ($version->isReleased() && $version->getReleaseDate() !== null) {
                 $date = new Date($version->getReleaseDate()->getTimestamp());
                 $html .= '<h3 title="' . '">' . $date->ago();
                 if ($this->printDownloadLinks && !$version->isYanked()) {
                     $html .= ' <a href="' . $version->getUrl() . '" target="_blank"><i class="fa fa-download"></i></a>';
                 }
                 $html .= '</h3>';
             }
             $html .= '<div class="version-wrapper">';
             foreach ($version->getChanges() as $label => $changes) {
                 $html .= '<ul class="' . $label . '">';
                 foreach ($changes as $change) {
                     $html .= '<li data-label="' . ucfirst($translator->translateTo($label)) . '">' . $change . '</li>';
                 }
                 $html .= '</ul>';
             }
             $html .= '</div>';
         }
     } catch (\Exception $e) {
         $html .= '<div class="alert alert-danger" style="text-align: center" role="alert">' . '<i class="fa fa-lg fa-exclamation-triangle"></i><br>' . '<b>Could not get Changelog!</b><br>' . 'Error: <em>' . $e->getMessage() . '</em>' . '</div>';
     }
     $html .= '</div></div>';
     if ($this->printFrame) {
         $html .= '</div>';
     }
     if ($this->printScripts) {
         $html .= $this->getScriptsHtml();
     }
     return $html;
 }
开发者ID:Syonix,项目名称:changelog-viewer,代码行数:55,代码来源:HtmlFormatter.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $categories = ForumCategories::all();
     $categorie = ForumCategories::where('slug', $id)->first();
     foreach ($categorie->subjects as $subject) {
         Date::setLocale('fr');
         $date = new Date($subject->created);
         $subject->when = $date->format('j F Y');
     }
     return view('forum.categorie.show', ['categorie' => $categorie]);
 }
开发者ID:AxelCardinaels,项目名称:CbSeraing-Laravel,代码行数:17,代码来源:ForumCategoriesController.php

示例7: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $sujet = ForumSubjects::where("id", $id)->first();
     $categorie = ForumCategories::find($sujet->category);
     foreach ($sujet->messages as $message) {
         Date::setLocale('fr');
         $date = new Date($message->created);
         $message->when = $date->format('j F Y');
         $message->message = $this::text_humanized($message->message);
         $message->message = BBCode::parse($message->message);
     }
     return view('forum.sujets.show', ['categorie' => $categorie, "sujet" => $sujet]);
 }
开发者ID:AxelCardinaels,项目名称:CbSeraing-Laravel,代码行数:19,代码来源:ForumSujetsController.php

示例8: getSnippets

 public function getSnippets()
 {
     $posts = Post::orderBy('created_at', 'desc')->take(self::NUMBER_OF_SNIPPETS)->get();
     foreach ($posts as $post) {
         $post->body = self::shorten_string($post->body, 40);
         Date::setLocale('de');
         $dt = new Date("" . $post->created_at . "");
         $dt = $dt->format('j F Y');
         $post->loc_date = $dt;
         $post->url = implode("-", explode(" ", $post->title));
     }
     return view('blog/index', ['posts' => $posts]);
 }
开发者ID:smax22,项目名称:personal-homepage,代码行数:13,代码来源:PostController.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $supportedLanguages = $request->getLanguages();
     $userLanguage = $this->config->get('app.locale');
     foreach ($supportedLanguages as $language) {
         $language = str_replace('_', '-', $language);
         if (isset($this->langs[$language])) {
             $userLanguage = $language;
             break;
         }
     }
     app('translator')->setLocale($userLanguage);
     Date::setLocale($userLanguage);
     return $next($request);
 }
开发者ID:xiaobailc,项目名称:Gitamin,代码行数:23,代码来源:Localize.php

示例10: getHome

 public function getHome()
 {
     if (Auth::check() && Auth::getUser()->getAttribute('admin') == 1) {
         return redirect('admin');
     } else {
         Date::setLocale('id');
         $user = Auth::getUser();
         $pewangi = \DB::table('pewangi')->select('nama')->get();
         $arrPewangi = array();
         foreach ($pewangi as $p) {
             $arrPewangi[$p->nama] = $p->nama;
         }
         return view('home', compact('user', 'arrPewangi'));
     }
 }
开发者ID:cuppyzh,项目名称:go_laundry,代码行数:15,代码来源:CustomerController.php

示例11: testTranslatesDays

 public function testTranslatesDays()
 {
     $days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
     foreach ($this->languages as $language) {
         $translations = (include "src/lang/{$language}/date.php");
         foreach ($days as $day) {
             $date = new Date($day);
             $date->setLocale($language);
             $this->assertTrue(isset($translations[$day]));
             $this->assertEquals($translations[$day], $date->format('l'), "Language: {$language}");
             // Full
             $this->assertEquals(substr($translations[$day], 0, 3), $date->format('D'), "Language: {$language}");
             // Short
         }
     }
 }
开发者ID:erpio,项目名称:Reportula,代码行数:16,代码来源:TranslationTest.php

示例12: asDateTime

 /**
  * Return a timestamp as DateTime object.
  *
  * @param  mixed  $value
  * @return \Carbon\Carbon
  */
 protected function asDateTime($value)
 {
     Date::setLocale('it');
     // If the value is already a DateTime instance, we will just skip the rest of
     // these checks since they will be a waste of time, and hinder performance
     // when checking the field. We will just return the DateTime right away.
     if ($value instanceof DateTime) {
         //
     } elseif (is_numeric($value)) {
         return Date::createFromTimestamp($value);
     } elseif (preg_match('/^(\\d{4})-(\\d{2})-(\\d{2})$/', $value)) {
         return Date::createFromFormat('Y-m-d', $value)->startOfDay();
     } elseif (!$value instanceof DateTime) {
         $format = $this->getDateFormat();
         return Date::createFromFormat($format, $value);
     }
     return Date::instance($value);
 }
开发者ID:AssociazionePrometeo,项目名称:doorkeeper-web,代码行数:24,代码来源:LocalizesDates.php

示例13: boot

 /**
  * Boot the service provider.
  *
  * @return void
  */
 public function boot()
 {
     $env = $this->app->environment();
     $repo = $this->app->make(Repository::class);
     $cache = $this->app->make(Cache::class);
     $loaded = $cache->load($env);
     $this->app->terminating(function () use($repo, $cache) {
         if ($repo->stale()) {
             $cache->clear();
         }
     });
     try {
         if ($loaded === false) {
             $loaded = $repo->all();
             $cache->store($env, $loaded);
         }
         $settings = array_merge($this->app->config->get('setting'), $loaded);
         $this->app->config->set('setting', $settings);
     } catch (Exception $e) {
         //
     }
     if ($appDomain = $this->app->config->get('setting.app_domain')) {
         $this->app->config->set('app.url', $appDomain);
     }
     if ($appLocale = $this->app->config->get('setting.app_locale')) {
         $this->app->config->set('app.locale', $appLocale);
         $this->app->translator->setLocale($appLocale);
         Date::setLocale($appLocale);
     }
     if ($appTimezone = $this->app->config->get('setting.app_timezone')) {
         $this->app->config->set('cachet.timezone', $appTimezone);
     }
     $allowedOrigins = $this->app->config->get('cors.defaults.allowedOrigins');
     if ($allowedDomains = $this->app->config->get('setting.allowed_domains')) {
         $domains = explode(',', $allowedDomains);
         foreach ($domains as $domain) {
             $allowedOrigins[] = $domain;
         }
     } else {
         $allowedOrigins[] = $this->app->config->get('app.url');
     }
     $this->app->config->set('cors.paths.api/v1/*.allowedOrigins', $allowedOrigins);
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:48,代码来源:ConfigServiceProvider.php

示例14: setup

	public function setup() {
		Date::setLocale('ru');
	}
开发者ID:petun,项目名称:ipad-slider,代码行数:3,代码来源:DateHelperTest.php

示例15: init

 public function init()
 {
     Date::setLocale('ru');
     $this->_initServiceLocator();
 }
开发者ID:petun,项目名称:ipad-slider,代码行数:5,代码来源:Application.php


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