当前位置: 首页>>代码示例>>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;未经允许,请勿转载。