From 1bab6b9707a4ac70ab61491d80166e6e27d66f8e Mon Sep 17 00:00:00 2001 From: denisdulici Date: Sat, 9 Dec 2017 18:47:06 +0300 Subject: [PATCH] fixed #137 --- app/Http/Controllers/Dashboard/Dashboard.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Dashboard/Dashboard.php b/app/Http/Controllers/Dashboard/Dashboard.php index 283c14703..6aed71170 100644 --- a/app/Http/Controllers/Dashboard/Dashboard.php +++ b/app/Http/Controllers/Dashboard/Dashboard.php @@ -36,9 +36,9 @@ class Dashboard extends Controller // Daily $day = array(); - - for ($j = $month_days; $j > -1; $j--) { - $day[$month_days - $j] = date("d M", strtotime("-$j day")); + $month_ago = $this->today->subMonth(); + for ($j = $month_days; $j > 0; $j--) { + $day[$month_days - $j] = $month_ago->addDay()->format('d M'); } $daily_income = $this->getCashFlow('income', 'daily'); @@ -48,9 +48,9 @@ class Dashboard extends Controller // Monthly $month = array(); - + $year_ago = $this->today->subYear(); for ($j = 12; $j >= 0; $j--) { - $month[12 - $j] = date("F-Y", strtotime(" -$j month")); + $month[12 - $j] = $year_ago->addMonth()->format('M Y'); } $monthly_income = $this->getCashFlow('income', 'monthly');