From f5cbed7c0cb73d5422699679e1e0b74df49294f8 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 22 Jan 2016 07:54:15 +0100 Subject: [PATCH] Added magic words "currentMonthEnd" and "currentMonthStart". --- app/Support/Binder/Date.php | 10 +++++++++- resources/views/reports/index.twig | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php index db75e43d18..08089fc103 100644 --- a/app/Support/Binder/Date.php +++ b/app/Support/Binder/Date.php @@ -32,6 +32,14 @@ class Date implements BinderInterface */ public static function routeBinder($value, $route) { + if($value === 'currentMonthStart') { + return Carbon::now()->startOfMonth(); + } + if($value === 'currentMonthEnd') { + return Carbon::now()->endOfMonth(); + } + + try { $date = new Carbon($value); } catch (Exception $e) { @@ -41,4 +49,4 @@ class Date implements BinderInterface return $date; } -} \ No newline at end of file +} diff --git a/resources/views/reports/index.twig b/resources/views/reports/index.twig index d27cca0e24..83e38c4f56 100644 --- a/resources/views/reports/index.twig +++ b/resources/views/reports/index.twig @@ -95,8 +95,8 @@
  • {{ 'report_this_month_quick'|_ }}