mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-29 02:11:12 -06:00
More magic words.
This commit is contained in:
parent
f5cbed7c0c
commit
f5a21f64c0
@ -45,14 +45,6 @@ class ReportController extends Controller
|
||||
{
|
||||
$start = Session::get('first');
|
||||
$months = $this->helper->listOfMonths($start);
|
||||
$startOfMonth = clone Session::get('start');
|
||||
$endOfMonth = clone Session::get('start');
|
||||
$startOfYear = clone Session::get('start');
|
||||
$endOfYear = clone Session::get('start');
|
||||
$startOfMonth->startOfMonth();
|
||||
$endOfMonth->endOfMonth();
|
||||
$startOfYear->startOfYear();
|
||||
$endOfYear->endOfYear();
|
||||
|
||||
// does the user have shared accounts?
|
||||
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
|
||||
@ -67,8 +59,7 @@ class ReportController extends Controller
|
||||
|
||||
return view(
|
||||
'reports.index', compact(
|
||||
'months', 'accounts', 'start', 'accountList',
|
||||
'startOfMonth', 'endOfMonth', 'startOfYear', 'endOfYear'
|
||||
'months', 'accounts', 'start', 'accountList'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -32,21 +32,25 @@ class Date implements BinderInterface
|
||||
*/
|
||||
public static function routeBinder($value, $route)
|
||||
{
|
||||
if($value === 'currentMonthStart') {
|
||||
return Carbon::now()->startOfMonth();
|
||||
}
|
||||
if($value === 'currentMonthEnd') {
|
||||
return Carbon::now()->endOfMonth();
|
||||
}
|
||||
switch ($value) {
|
||||
default:
|
||||
try {
|
||||
$date = new Carbon($value);
|
||||
} catch (Exception $e) {
|
||||
Log::error('Could not parse date "' . $value . '" for user #' . Auth::user()->id);
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
return $date;
|
||||
case 'currentMonthStart':
|
||||
return Carbon::now()->startOfMonth();
|
||||
case 'currentMonthEnd':
|
||||
return Carbon::now()->endOfMonth();
|
||||
case 'currentYearStart':
|
||||
return Carbon::now()->startOfYear();
|
||||
case 'currentYearEnd':
|
||||
return Carbon::now()->endOfYear();
|
||||
|
||||
try {
|
||||
$date = new Carbon($value);
|
||||
} catch (Exception $e) {
|
||||
Log::error('Could not parse date "' . $value . '" for user #' . Auth::user()->id);
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
return $date;
|
||||
}
|
||||
}
|
||||
|
@ -103,8 +103,8 @@
|
||||
<li>
|
||||
<a href="{{ route('reports.report',
|
||||
['default',
|
||||
startOfYear.format('Ymd'),
|
||||
endOfYear.format('Ymd'),
|
||||
'currentYearStart',
|
||||
'currentYearEnd',
|
||||
accountList
|
||||
]) }}">{{ 'report_this_year_quick'|_ }}</a>
|
||||
</li>
|
||||
@ -112,7 +112,7 @@
|
||||
<a href="{{ route('reports.report',
|
||||
['default',
|
||||
start.format('Ymd'),
|
||||
endOfMonth.format('Ymd'),
|
||||
'currentMonthEnd',
|
||||
accountList
|
||||
]) }}">{{ 'report_all_time_quick'|_ }}</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user