Some code simplification.

This commit is contained in:
James Cole
2016-11-26 08:41:15 +01:00
parent d6c7ff0ccb
commit 6bc6674ab1
3 changed files with 78 additions and 30 deletions

View File

@@ -28,6 +28,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection;
use Log;
use Navigation;
use stdClass;
/**
@@ -233,16 +234,7 @@ class BudgetRepository implements BudgetRepositoryInterface
// this is the date format we need:
// define period to group on:
$carbonFormat = 'Y-m-d';
// monthly report (for year)
if ($start->diffInMonths($end) > 1) {
$carbonFormat = 'Y-m';
}
// yearly report (for multi year)
if ($start->diffInMonths($end) > 12) {
$carbonFormat = 'Y';
}
$carbonFormat = Navigation::preferredCarbonFormat($start, $end);
// this is the set of transactions for this period
// in these budgets. Now they must be grouped (manually)