當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Date::yesterday方法代碼示例

本文整理匯總了PHP中Jenssegers\Date\Date::yesterday方法的典型用法代碼示例。如果您正苦於以下問題:PHP Date::yesterday方法的具體用法?PHP Date::yesterday怎麽用?PHP Date::yesterday使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Jenssegers\Date\Date的用法示例。


在下文中一共展示了Date::yesterday方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: live

 /**
  * @return \Illuminate\Http\JsonResponse
  */
 public function live()
 {
     $match = $this->matches->with(['events', 'competition', 'team_as_home', 'team_as_away'])->whereNotIn('status', ['FT', 'Postp.'])->whereDate('formatted_date', '>=', Date::yesterday()->format('Y-m-d'))->orderBy('formatted_date', 'asc')->first();
     return response()->json($match);
 }
開發者ID:boynoiz,項目名稱:liverpoolthailand,代碼行數:8,代碼來源:FootballAPIController.php

示例2: LiveMatch

 /**
  *
  * @return array|string|static[]
  */
 public function LiveMatch()
 {
     $getMatchId = $this->footballMatches->whereNotIn('status', ['FT', 'Postp.'])->whereDate('formatted_date', '>=', Date::yesterday()->format('Y-m-d'))->orderBy('formatted_date', 'asc')->first();
     $request = 'matches/' . $getMatchId['match_id'] . '?';
     $match = $this->connector($request);
     $match['match_id'] = $match['id'];
     unset($match['id']);
     $mergeDateTime = Date::createFromFormat('d.m.Y H:i', $match['formatted_date'] . ' ' . $match['time'], 'UTC')->tz('Asia/Bangkok')->toDateTimeString();
     $date = Date::createFromFormat('Y-m-d H:i:s', $mergeDateTime)->format('Y-m-d');
     $match['formatted_date'] = $date;
     $time = Date::createFromFormat('Y-m-d H:i:s', $mergeDateTime)->format('H:i');
     $matchStatus = $match['status'];
     $match['status'] === $match['time'] ? $match['status'] = $time : ($match['status'] = $matchStatus);
     $match['time'] = $time;
     if ($match['localteam_score'] === '?' and $match['visitorteam_score'] === '?' or $match['localteam_score'] === '' and $match['visitorteam_score'] === '') {
         if ($match['status'] !== 'FT' or $match['status'] !== 'AET') {
             $match['localteam_score'] = '-';
             $match['visitorteam_score'] = '-';
         }
     }
     $this->footballMatches->updateOrCreate(['match_id' => $match['match_id']], $match);
     if (!empty($match['events'])) {
         $matchEvents = $match['events'];
         $matchId = $match['match_id'];
         foreach ($matchEvents as $matchEvent) {
             $matchEvent['match_id'] = $matchId;
             $matchEvent['event_id'] = $matchEvent['id'];
             unset($matchEvent['id']);
             $this->footballMatchEvents->updateOrCreate(['event_id' => $matchEvent['event_id']], $matchEvent) ? Log::info('Event of ' . $matchId . ' update completed!.') : Log::error('Event update process of ' . $matchId . ' failed');
         }
     }
     Event::fire(new FootballMatchUpdated($this->footballMatches));
     return Log::info('All data of ' . $match['match_id'] . ' update completed!');
 }
開發者ID:boynoiz,項目名稱:liverpoolthailand,代碼行數:38,代碼來源:FootballController.php


注:本文中的Jenssegers\Date\Date::yesterday方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。