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) public static function routeBinder($value, $route)
{ {
if($value === 'currentMonthStart') {
return Carbon::now()->startOfMonth();
}
if($value === 'currentMonthEnd') {
return Carbon::now()->endOfMonth();
}
try { try {
$date = new Carbon($value); $date = new Carbon($value);
} catch (Exception $e) { } catch (Exception $e) {
@ -41,4 +49,4 @@ class Date implements BinderInterface
return $date; return $date;
} }
} }

View File

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