/** * @return array */ protected function prepareValues() { $periods = $this->configuration->getPeriods(); $values = []; foreach ($periods as $period) { $values[$period->format($this->configuration->getGroupByDateFormat())] = ['value' => 0, 'meta' => $period->format($this->configuration->getDatePresentationFormat())]; } return $values; }
/** * Filters a collection to get only current items * * @param Collection $collection * * @return Collection */ protected function filterCurrentItems(Collection $collection) { $endDate = new DateTime(); $format = $this->configuration->getGroupByDateFormat(); $identifier = $endDate->format($format); return $collection->filter(function (ReportRow $row) use($identifier) { return $row->getIdentifier() === $identifier; }); }