本文整理汇总了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);
}
示例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!');
}