Ensure that only future events can be retrieved

This commit is contained in:
Oliver Davies 2019-01-18 21:44:21 +00:00
parent 306082d17b
commit fddaa56ed2
2 changed files with 30 additions and 8 deletions

View file

@ -61,11 +61,9 @@ class TalksExtension extends Twig_Extension
*/
public function getUpcoming($talks, array $eventData = [])
{
return $this->format($talks, $eventData)
->filter(function ($talk) {
return $talk['event']['date'] >= $this->today;
})
->sortBy('event.date');
return $this->getAll($talks)->filter(function ($talk) {
return collect($talk['events'])->pluck('date')->sort()->last() >= $this->today;
})->values();
}
/**
@ -80,7 +78,7 @@ class TalksExtension extends Twig_Extension
{
return $this->getAll($talks)->filter(function ($talk) {
return collect($talk['events'])->pluck('date')->sort()->last() < $this->today;
});
})->values();
}
/**