Added magic words "currentMonthEnd" and "currentMonthStart".

This commit is contained in:
James Cole 2016-01-22 07:54:15 +01:00
parent 59fff8928b
commit f5cbed7c0c
2 changed files with 11 additions and 3 deletions

View File

@ -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;
}
}
}

View File

@ -95,8 +95,8 @@
<li>
<a href="{{ route('reports.report',
['default',
startOfMonth.format('Ymd'),
endOfMonth.format('Ymd'),
'currentMonthStart',
'currentMonthEnd',
accountList
]) }}">{{ 'report_this_month_quick'|_ }}</a>
</li>