Code clean up.

This commit is contained in:
James Cole
2017-11-15 11:33:07 +01:00
parent ef837f20dd
commit 57dcdfa0c4
60 changed files with 398 additions and 347 deletions

View File

@@ -132,7 +132,7 @@ class ReconcileController extends Controller
return view(
'accounts.reconcile.index',
compact(
'account',
'account',
'currency',
'subTitleIcon',
'start',
@@ -141,11 +141,11 @@ class ReconcileController extends Controller
'startBalance',
'endBalance',
'transactionsUri',
'selectionStart',
'selectionStart',
'selectionEnd',
'overviewUri',
'indexUri'
)
)
);
}

View File

@@ -209,7 +209,7 @@ class AccountController extends Controller
return view(
'accounts.edit',
compact(
'allCurrencies',
'allCurrencies',
'currencySelectList',
'account',
'currency',
@@ -218,7 +218,7 @@ class AccountController extends Controller
'what',
'roles',
'preFilled'
)
)
);
}

View File

@@ -85,14 +85,18 @@ class LoginController extends Controller
$hasTable = Schema::hasTable('users');
if (!$hasTable) {
$message = 'Firefly III could not find the "users" table. This is a strong indication your database credentials are wrong or the database has not been initialized. Did you follow the installation instructions correctly?';
$message
= 'Firefly III could not find the "users" table. This is a strong indication your database credentials are wrong or the database has not been initialized. Did you follow the installation instructions correctly?';
return view('error', compact('message'));
}
// check for presence of currency:
$currency = TransactionCurrency::where('code', 'EUR')->first();
if (is_null($currency)) {
$message = 'Firefly III could not find the EURO currency. This is a strong indication the database has not been initialized correctly. Did you follow the installation instructions?';
$message
= 'Firefly III could not find the EURO currency. This is a strong indication the database has not been initialized correctly. Did you follow the installation instructions?';
return view('error', compact('message'));
}

View File

@@ -160,9 +160,9 @@ class RegisterController extends Controller
return Validator::make(
$data,
[
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|secure_password|confirmed',
]
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|secure_password|confirmed',
]
);
}
}

View File

@@ -455,10 +455,10 @@ class BudgetController extends Controller
$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),
]
);
// collector:

View File

@@ -123,7 +123,7 @@ class HomeController extends Controller
return view(
'debug',
compact(
'phpVersion',
'phpVersion',
'extensions',
'carbon',
'now',
@@ -136,7 +136,7 @@ class HomeController extends Controller
'isDocker',
'isSandstorm',
'trustedProxies'
)
)
);
}

View File

@@ -291,11 +291,11 @@ class PiggyBankController extends Controller
Session::flash(
'success',
strval(
trans(
'firefly.added_amount_to_piggy',
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
)
)
trans(
'firefly.added_amount_to_piggy',
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
)
)
);
Preferences::mark();
@@ -306,11 +306,11 @@ class PiggyBankController extends Controller
Session::flash(
'error',
strval(
trans(
'firefly.cannot_add_amount_piggy',
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
)
)
trans(
'firefly.cannot_add_amount_piggy',
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
)
)
);
return redirect(route('piggy-banks.index'));
@@ -348,11 +348,11 @@ class PiggyBankController extends Controller
Session::flash(
'error',
strval(
trans(
'firefly.cannot_remove_from_piggy',
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
)
)
trans(
'firefly.cannot_remove_from_piggy',
['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
)
)
);
return redirect(route('piggy-banks.index'));

View File

@@ -90,12 +90,12 @@ class ReportController extends Controller
View::share(
'subTitle',
trans(
'firefly.report_audit',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
'firefly.report_audit',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
);
@@ -126,12 +126,12 @@ class ReportController extends Controller
View::share(
'subTitle',
trans(
'firefly.report_budget',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
'firefly.report_budget',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
);
$generator = ReportGeneratorFactory::reportGenerator('Budget', $start, $end);
@@ -162,12 +162,12 @@ class ReportController extends Controller
View::share(
'subTitle',
trans(
'firefly.report_category',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
'firefly.report_category',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
);
$generator = ReportGeneratorFactory::reportGenerator('Category', $start, $end);
@@ -198,12 +198,12 @@ class ReportController extends Controller
View::share(
'subTitle',
trans(
'firefly.report_default',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
'firefly.report_default',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
);
$generator = ReportGeneratorFactory::reportGenerator('Standard', $start, $end);
@@ -344,12 +344,12 @@ class ReportController extends Controller
View::share(
'subTitle',
trans(
'firefly.report_tag',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
'firefly.report_tag',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
);
$generator = ReportGeneratorFactory::reportGenerator('Tag', $start, $end);

View File

@@ -213,15 +213,15 @@ class RuleController extends Controller
return view(
'rules.rule.edit',
compact(
'rule',
'rule',
'subTitle',
'primaryTrigger',
'primaryTrigger',
'oldTriggers',
'oldActions',
'triggerCount',
'actionCount',
'ruleGroups'
)
)
);
}

View File

@@ -94,10 +94,10 @@ Breadcrumbs::register(
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('accounts.show', [$account->id, $moment, $start, $end]));
}
}
@@ -344,10 +344,10 @@ Breadcrumbs::register(
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('budgets.no-budget', [$moment]));
}
}
@@ -369,15 +369,15 @@ Breadcrumbs::register(
$breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id]));
$title = trans(
'firefly.between_dates_breadcrumb',
['start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),]
);
'firefly.between_dates_breadcrumb',
['start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),]
);
$breadcrumbs->push(
$title,
route('budgets.show.limit', [$budget->id, $budgetLimit->id])
);
$title,
route('budgets.show.limit', [$budget->id, $budgetLimit->id])
);
}
);
@@ -427,10 +427,10 @@ Breadcrumbs::register(
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('categories.show', [$category->id, $moment]));
}
}
@@ -450,10 +450,10 @@ Breadcrumbs::register(
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('categories.no-category', [$moment]));
}
}
@@ -559,9 +559,9 @@ Breadcrumbs::register(
function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) {
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
$breadcrumbs->push(
trans('firefly.remove_money_from_piggy_title', ['name' => $piggyBank->name]),
route('piggy-banks.remove-money-mobile', [$piggyBank->id])
);
trans('firefly.remove_money_from_piggy_title', ['name' => $piggyBank->name]),
route('piggy-banks.remove-money-mobile', [$piggyBank->id])
);
}
);
@@ -795,7 +795,9 @@ Breadcrumbs::register(
'rule-groups.select-transactions',
function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) {
$breadcrumbs->parent('rules.index');
$breadcrumbs->push(trans('firefly.rule_group_select_transactions', ['title' => $ruleGroup->title]), route('rule-groups.select-transactions', [$ruleGroup]));
$breadcrumbs->push(
trans('firefly.rule_group_select_transactions', ['title' => $ruleGroup->title]), route('rule-groups.select-transactions', [$ruleGroup])
);
}
);
@@ -804,9 +806,9 @@ Breadcrumbs::register(
function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) {
$breadcrumbs->parent('rules.index');
$breadcrumbs->push(
trans('firefly.execute_group_on_existing_transactions', ['title' => $ruleGroup->title]),
route('rule-groups.select_transactions', [$ruleGroup])
);
trans('firefly.execute_group_on_existing_transactions', ['title' => $ruleGroup->title]),
route('rule-groups.select_transactions', [$ruleGroup])
);
}
);
@@ -870,10 +872,10 @@ Breadcrumbs::register(
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('tags.show', [$tag->id, $moment]));
}
}
@@ -894,10 +896,10 @@ Breadcrumbs::register(
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
'firefly.between_dates_breadcrumb',
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('transactions.index', [$what, $moment]));
}
}
@@ -940,9 +942,9 @@ Breadcrumbs::register(
function (BreadCrumbGenerator $breadcrumbs, TransactionType $destinationType, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.show', $journal);
$breadcrumbs->push(
trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]),
route('transactions.convert.index', [strtolower($destinationType->type), $journal->id])
);
trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]),
route('transactions.convert.index', [strtolower($destinationType->type), $journal->id])
);
}
);