/**
  * {@inheritDoc}
  */
 public function render()
 {
     $dataProvider = new DataProvider();
     $budgetControlService = new BudgetControlService(new PurchaseService($dataProvider), new Goalr());
     $monthlyGoal = MonthlyGoal::query()->mine()->currentMonth()->first();
     if ($monthlyGoal) {
         $todayBudget = new Currency($budgetControlService->getDailyMonthlyBudget($monthlyGoal, \BackendAuth::getUser()));
         $todayBudget->setFormat('{number}');
         $todaySpent = new Currency(Purchase::calcAmountByPeriod(new \DateTime(), new \DateTime(), \BackendAuth::getUser()->id));
         $todaySpent->setFormat('{number}');
         $this->vars['todaySpent'] = $todaySpent;
         $this->vars['todayBudget'] = $todayBudget;
         return $this->makePartial('dailybudget');
     } else {
         return $this->makePartial('no_monthly_goal');
     }
 }
 /**
  * @param int $monthly_goal_id
  * @return bool
  */
 public function deleteMonthlyGoal($monthly_goal_id)
 {
     return MonthlyGoal::find($monthly_goal_id)->delete();
 }