I'm trying to get the closest upcoming match to today, but instead, I get the latest created record with the code I write. How can I change the code to find the date closest to today?
$upcomingMatch = Match::leftjoin('scores', 'matches.id', '=', 'scores.match_id')
->where(function ($where) {
$where->where('matches.away_team_id', '=', '1')
->orWhere('matches.home_team_id', '=', '1');
})
->whereNull('scores.id')
->latest('matches.match_date')
->first();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire