mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Code cleanup that (hopefully) matches style CI
This commit is contained in:
@@ -34,7 +34,9 @@ use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\AugumentData;
|
||||
use FireflyIII\Support\Http\Controllers\PeriodOverview;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -57,7 +59,7 @@ class ShowController extends Controller
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string)trans('firefly.budgets'));
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
$this->journalRepos = app(JournalRepositoryInterface::class);
|
||||
|
||||
@@ -69,11 +71,11 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show transactions without a budget.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
@@ -92,8 +94,8 @@ class ShowController extends Controller
|
||||
$first = $this->journalRepos->firstNull();
|
||||
$firstDate = null !== $first ? $first->date : $start;
|
||||
$periods = $this->getNoBudgetPeriodOverview($firstDate, $end);
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -110,17 +112,17 @@ class ShowController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function noBudgetAll(Request $request)
|
||||
{
|
||||
|
||||
$subTitle = (string)trans('firefly.all_journals_without_budget');
|
||||
$subTitle = (string) trans('firefly.all_journals_without_budget');
|
||||
$first = $this->journalRepos->firstNull();
|
||||
$start = null === $first ? new Carbon : $first->date;
|
||||
$end = new Carbon;
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -137,23 +139,23 @@ class ShowController extends Controller
|
||||
* Show a single budget.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function show(Request $request, Budget $budget)
|
||||
{
|
||||
/** @var Carbon $start */
|
||||
$allStart = session('first', Carbon::now()->startOfYear());
|
||||
$allEnd = new Carbon;
|
||||
$allStart = session('first', Carbon::now()->startOfYear());
|
||||
$allEnd = new Carbon;
|
||||
|
||||
// use session range:
|
||||
$start = session('start');
|
||||
$end = session('end');
|
||||
$end = session('end');
|
||||
|
||||
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$limits = $this->getLimits($budget, $allStart, $allEnd);
|
||||
$repetition = null;
|
||||
|
||||
@@ -161,12 +163,12 @@ class ShowController extends Controller
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setRange($start, $end)->setBudget($budget)
|
||||
->withAccountInformation()
|
||||
->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation();
|
||||
->withAccountInformation()
|
||||
->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation();
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('budgets.show', [$budget->id]));
|
||||
|
||||
$subTitle = (string)trans('firefly.all_journals_for_budget', ['name' => $budget->name]);
|
||||
$subTitle = (string) trans('firefly.all_journals_for_budget', ['name' => $budget->name]);
|
||||
|
||||
return view('budgets.show', compact('limits', 'budget', 'repetition', 'groups', 'subTitle'));
|
||||
}
|
||||
@@ -174,12 +176,12 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show a single budget by a budget limit.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @throws FireflyException
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
|
||||
{
|
||||
@@ -187,14 +189,14 @@ class ShowController extends Controller
|
||||
throw new FireflyException('This budget limit is not part of this budget.'); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$subTitle = trans(
|
||||
'firefly.budget_in_period',
|
||||
[
|
||||
'name' => $budget->name,
|
||||
'start' => $budgetLimit->start_date->formatLocalized($this->monthAndDayFormat),
|
||||
'end' => $budgetLimit->end_date->formatLocalized($this->monthAndDayFormat),
|
||||
'name' => $budget->name,
|
||||
'start' => $budgetLimit->start_date->formatLocalized($this->monthAndDayFormat),
|
||||
'end' => $budgetLimit->end_date->formatLocalized($this->monthAndDayFormat),
|
||||
'currency' => $budgetLimit->transactionCurrency->name,
|
||||
]
|
||||
);
|
||||
|
Reference in New Issue
Block a user