addProperty($start); $cache->addProperty($end); $cache->addProperty('budget-period-report'); $cache->addProperty($accounts->pluck('id')->toArray()); if ($cache->has()) { return $cache->get(); } $periods = Navigation::listOfPeriods($start, $end); $budgets = $helper->getBudgetPeriodReport($start, $end, $accounts); $result = view('reports.partials.budget-period', compact('budgets', 'periods'))->render(); $cache->store($result); return $result; } /** * @param BudgetReportHelperInterface $helper * @param Carbon $start * @param Carbon $end * @param Collection $accounts * * @return string */ public function budgetReport(BudgetReportHelperInterface $helper, Carbon $start, Carbon $end, Collection $accounts) { // chart properties for cache: $cache = new CacheProperties; $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('budget-report'); $cache->addProperty($accounts->pluck('id')->toArray()); if ($cache->has()) { return $cache->get(); } $budgets = $helper->getBudgetReport($start, $end, $accounts); $result = view('reports.partials.budgets', compact('budgets'))->render(); $cache->store($result); return $result; } }