mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 10:16:49 +00:00
Code cleanup.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Http\Requests\AccountFormRequest;
|
||||
use FireflyIII\Models\Account;
|
||||
@@ -40,7 +39,7 @@ class AccountController extends Controller
|
||||
{
|
||||
|
||||
|
||||
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
|
||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
|
||||
$subTitle = trans('firefly.make_new_' . $what . '_account');
|
||||
Session::flash('preFilled', []);
|
||||
|
||||
@@ -64,7 +63,7 @@ class AccountController extends Controller
|
||||
*/
|
||||
public function delete(ARI $repository, Account $account)
|
||||
{
|
||||
$typeName = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);
|
||||
$accountList = ExpandedForm::makeSelectList($repository->getAccounts([$account->accountType->type]), true);
|
||||
unset($accountList[$account->id]);
|
||||
@@ -86,7 +85,7 @@ class AccountController extends Controller
|
||||
public function destroy(ARI $repository, Account $account)
|
||||
{
|
||||
$type = $account->accountType->type;
|
||||
$typeName = Config::get('firefly.shortNamesByFullName.' . $type);
|
||||
$typeName = config('firefly.shortNamesByFullName.' . $type);
|
||||
$name = $account->name;
|
||||
$moveTo = $repository->find(intval(Input::get('move_account_before_delete')));
|
||||
|
||||
@@ -107,9 +106,9 @@ class AccountController extends Controller
|
||||
public function edit(ARI $repository, Account $account)
|
||||
{
|
||||
|
||||
$what = Config::get('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||
$subTitle = trans('firefly.edit_' . $what . '_account', ['name' => $account->name]);
|
||||
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
|
||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
|
||||
$openingBalance = $repository->openingBalanceTransaction($account);
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
@@ -155,8 +154,8 @@ class AccountController extends Controller
|
||||
$what = $what ?? 'asset';
|
||||
|
||||
$subTitle = trans('firefly.' . $what . '_accounts');
|
||||
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
|
||||
$types = Config::get('firefly.accountTypesByIdentifier.' . $what);
|
||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $what);
|
||||
$types = config('firefly.accountTypesByIdentifier.' . $what);
|
||||
$accounts = $repository->getAccounts($types);
|
||||
/** @var Carbon $start */
|
||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
||||
@@ -190,8 +189,8 @@ class AccountController extends Controller
|
||||
{
|
||||
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
|
||||
$pageSize = Preferences::get('transactionPageSize', 50)->data;
|
||||
$subTitleIcon = Config::get('firefly.subTitlesByIdentifier.' . $account->accountType->type);
|
||||
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$subTitleIcon = config('firefly.subTitlesByIdentifier.' . $account->accountType->type);
|
||||
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$journals = $repository->getJournals($account, $page, $pageSize);
|
||||
$subTitle = trans('firefly.details_for_' . $what, ['name' => $account->name]);
|
||||
$journals->setPath('accounts/show/' . $account->id);
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Http\Controllers\Auth;
|
||||
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyIII\Events\ResendConfirmation;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
@@ -48,7 +47,7 @@ class ConfirmationController extends Controller
|
||||
$database = Preferences::get('user_confirmed_code')->data;
|
||||
$time = Preferences::get('user_confirmed_last_mail', 0)->data;
|
||||
$now = time();
|
||||
$maxDiff = Config::get('firefly.confirmation_age');
|
||||
$maxDiff = config('firefly.confirmation_age');
|
||||
|
||||
if ($database === $code && ($now - $time <= $maxDiff)) {
|
||||
Preferences::setForUser(Auth::user(), 'user_confirmed', true);
|
||||
@@ -68,7 +67,7 @@ class ConfirmationController extends Controller
|
||||
{
|
||||
$time = Preferences::get('user_confirmed_last_mail', 0)->data;
|
||||
$now = time();
|
||||
$maxDiff = Config::get('firefly.resend_confirmation');
|
||||
$maxDiff = config('firefly.resend_confirmation');
|
||||
$owner = env('SITE_OWNER', 'mail@example.com');
|
||||
if ($now - $time > $maxDiff) {
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Config;
|
||||
use FireflyIII\Http\Requests\BillFormRequest;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
@@ -34,7 +33,7 @@ class BillController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$periods = Config::get('firefly.periods_to_text');
|
||||
$periods = config('firefly.periods_to_text');
|
||||
$subTitle = trans('firefly.create_new_bill');
|
||||
|
||||
|
||||
@@ -89,7 +88,7 @@ class BillController extends Controller
|
||||
*/
|
||||
public function edit(Bill $bill)
|
||||
{
|
||||
$periods = Config::get('firefly.periods_to_text');
|
||||
$periods = config('firefly.periods_to_text');
|
||||
$subTitle = trans('firefly.edit_bill', ['name' => $bill->name]);
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
|
@@ -163,8 +163,6 @@ class BudgetController extends Controller
|
||||
/**
|
||||
* Warn user if necessary
|
||||
*/
|
||||
$range = Preferences::get('viewRange', '1M')->data;
|
||||
$repeatFreq = Config::get('firefly.range_to_repeat_freq.' . $range);
|
||||
$userWarning = '';
|
||||
if (session('is_custom_range', false) === true) {
|
||||
$userWarning = strval(trans('firefly.warn_range_' . $repeatFreq));
|
||||
|
@@ -9,8 +9,8 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
|
||||
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface as SCRI;
|
||||
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface as SCRI;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Navigation;
|
||||
|
@@ -3,7 +3,6 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Config;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Csv\Data;
|
||||
@@ -39,7 +38,7 @@ class CsvController extends Controller
|
||||
View::share('title', trans('firefly.csv'));
|
||||
View::share('mainTitleIcon', 'fa-file-text-o');
|
||||
|
||||
if (Config::get('firefly.csv_import_enabled') === false) {
|
||||
if (config('firefly.csv_import_enabled') === false) {
|
||||
throw new FireflyException('CSV Import is not enabled.');
|
||||
}
|
||||
|
||||
@@ -81,7 +80,7 @@ class CsvController extends Controller
|
||||
if ($this->data->hasHeaders()) {
|
||||
$headers = $firstRow;
|
||||
}
|
||||
$keys = array_keys(Config::get('csv.roles'));
|
||||
$keys = array_keys(config('csv.roles'));
|
||||
foreach ($keys as $name) {
|
||||
$availableRoles[$name] = trans('firefly.csv_column_' . $name);
|
||||
}
|
||||
@@ -179,7 +178,7 @@ class CsvController extends Controller
|
||||
|
||||
// get list of supported specifix
|
||||
$specifix = [];
|
||||
foreach (Config::get('csv.specifix') as $entry) {
|
||||
foreach (config('csv.specifix') as $entry) {
|
||||
$specifix[$entry] = trans('firefly.csv_specifix_' . $entry);
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Export\Processor;
|
||||
@@ -106,8 +105,8 @@ class ExportController extends Controller
|
||||
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
|
||||
$accountList = ExpandedForm::makeSelectList($accounts);
|
||||
$checked = array_keys($accountList);
|
||||
$formats = array_keys(Config::get('firefly.export_formats'));
|
||||
$defaultFormat = Preferences::get('export_format', Config::get('firefly.default_export_format'))->data;
|
||||
$formats = array_keys(config('firefly.export_formats'));
|
||||
$defaultFormat = Preferences::get('export_format', config('firefly.default_export_format'))->data;
|
||||
$first = session('first')->format('Y-m-d');
|
||||
$today = Carbon::create()->format('Y-m-d');
|
||||
|
||||
|
@@ -3,13 +3,11 @@
|
||||
use Amount;
|
||||
use Artisan;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Input;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Route;
|
||||
use Session;
|
||||
@@ -34,9 +32,9 @@ class HomeController extends Controller
|
||||
public function dateRange()
|
||||
{
|
||||
|
||||
$start = new Carbon(Input::get('start'));
|
||||
$end = new Carbon(Input::get('end'));
|
||||
$label = Input::get('label');
|
||||
$start = new Carbon(Input::get('start'));
|
||||
$end = new Carbon(Input::get('end'));
|
||||
$label = Input::get('label');
|
||||
|
||||
// check if the label is "everything" or "Custom range" which will betray
|
||||
// a possible problem with the budgets.
|
||||
@@ -101,7 +99,7 @@ class HomeController extends Controller
|
||||
*/
|
||||
public function index(ARI $repository)
|
||||
{
|
||||
$types = Config::get('firefly.accountTypesByIdentifier.asset');
|
||||
$types = config('firefly.accountTypesByIdentifier.asset');
|
||||
$count = $repository->countAccounts($types);
|
||||
|
||||
if ($count == 0) {
|
||||
@@ -168,7 +166,7 @@ class HomeController extends Controller
|
||||
$methods = $route->getMethods();
|
||||
|
||||
if (!is_null($name) && in_array('GET', $methods) && !$this->startsWithAny($ignore, $name)) {
|
||||
foreach (array_keys(Config::get('firefly.languages')) as $lang) {
|
||||
foreach (array_keys(config('firefly.languages')) as $lang) {
|
||||
echo 'touch ' . $lang . '/' . $name . '.md<br>';
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
use Amount;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
@@ -36,7 +35,7 @@ class JsonController extends Controller
|
||||
public function action()
|
||||
{
|
||||
$count = intval(Input::get('count')) > 0 ? intval(Input::get('count')) : 1;
|
||||
$keys = array_keys(Config::get('firefly.rule-actions'));
|
||||
$keys = array_keys(config('firefly.rule-actions'));
|
||||
$actions = [];
|
||||
foreach ($keys as $key) {
|
||||
$actions[$key] = trans('firefly.rule_action_' . $key . '_choice');
|
||||
@@ -297,7 +296,7 @@ class JsonController extends Controller
|
||||
public function trigger()
|
||||
{
|
||||
$count = intval(Input::get('count')) > 0 ? intval(Input::get('count')) : 1;
|
||||
$keys = array_keys(Config::get('firefly.rule-triggers'));
|
||||
$keys = array_keys(config('firefly.rule-triggers'));
|
||||
$triggers = [];
|
||||
foreach ($keys as $key) {
|
||||
if ($key != 'user_action') {
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use FireflyIII\Http\Requests\NewUserFormRequest;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use Preferences;
|
||||
@@ -36,7 +35,7 @@ class NewUserController extends Controller
|
||||
View::share('mainTitleIcon', 'fa-fire');
|
||||
|
||||
|
||||
$types = Config::get('firefly.accountTypesByIdentifier.asset');
|
||||
$types = config('firefly.accountTypesByIdentifier.asset');
|
||||
$count = $repository->countAccounts($types);
|
||||
|
||||
if ($count > 0) {
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
use Amount;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Http\Requests\PiggyBankFormRequest;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
@@ -65,7 +64,7 @@ class PiggyBankController extends Controller
|
||||
public function create(ARI $repository)
|
||||
{
|
||||
|
||||
$periods = Config::get('firefly.piggy_bank_periods');
|
||||
$periods = config('firefly.piggy_bank_periods');
|
||||
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
|
||||
$subTitle = trans('firefly.new_piggy_bank');
|
||||
$subTitleIcon = 'fa-plus';
|
||||
@@ -124,7 +123,7 @@ class PiggyBankController extends Controller
|
||||
public function edit(ARI $repository, PiggyBank $piggyBank)
|
||||
{
|
||||
|
||||
$periods = Config::get('firefly.piggy_bank_periods');
|
||||
$periods = config('firefly.piggy_bank_periods');
|
||||
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
|
||||
$subTitle = trans('firefly.update_piggy_title', ['name' => $piggyBank->name]);
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyIII\Http\Requests\TokenFormRequest;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use Input;
|
||||
@@ -155,7 +154,7 @@ class PreferencesController extends Controller
|
||||
|
||||
// language:
|
||||
$lang = Input::get('language');
|
||||
if (in_array($lang, array_keys(Config::get('firefly.languages')))) {
|
||||
if (in_array($lang, array_keys(config('firefly.languages')))) {
|
||||
Preferences::set('language', $lang);
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyIII\Http\Requests\RuleFormRequest;
|
||||
use FireflyIII\Http\Requests\TestRuleFormRequest;
|
||||
use FireflyIII\Models\Rule;
|
||||
@@ -292,8 +291,8 @@ class RuleController extends Controller
|
||||
return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]);
|
||||
}
|
||||
|
||||
$limit = Config::get('firefly.test-triggers.limit');
|
||||
$range = Config::get('firefly.test-triggers.range');
|
||||
$limit = config('firefly.test-triggers.limit');
|
||||
$range = config('firefly.test-triggers.range');
|
||||
|
||||
/** @var TransactionMatcher $matcher */
|
||||
$matcher = app('FireflyIII\Rules\TransactionMatcher');
|
||||
|
@@ -3,7 +3,6 @@
|
||||
use Amount;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use ExpandedForm;
|
||||
use FireflyIII\Events\TransactionJournalStored;
|
||||
use FireflyIII\Events\TransactionJournalUpdated;
|
||||
@@ -212,8 +211,8 @@ class TransactionController extends Controller
|
||||
public function index(JournalRepositoryInterface $repository, string $what)
|
||||
{
|
||||
$pageSize = Preferences::get('transactionPageSize', 50)->data;
|
||||
$subTitleIcon = Config::get('firefly.transactionIconsByWhat.' . $what);
|
||||
$types = Config::get('firefly.transactionTypesByWhat.' . $what);
|
||||
$subTitleIcon = config('firefly.transactionIconsByWhat.' . $what);
|
||||
$types = config('firefly.transactionTypesByWhat.' . $what);
|
||||
$subTitle = trans('firefly.title_' . $what);
|
||||
$page = intval(Input::get('page'));
|
||||
$journals = $repository->getJournalsOfTypes($types, $page, $pageSize);
|
||||
|
@@ -4,7 +4,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyIII\Models\Account;
|
||||
use Input;
|
||||
|
||||
@@ -30,9 +29,9 @@ class AccountFormRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$accountRoles = join(',', array_keys(Config::get('firefly.accountRoles')));
|
||||
$types = join(',', array_keys(Config::get('firefly.subTitlesByIdentifier')));
|
||||
$ccPaymentTypes = join(',', array_keys(Config::get('firefly.ccTypes')));
|
||||
$accountRoles = join(',', array_keys(config('firefly.accountRoles')));
|
||||
$types = join(',', array_keys(config('firefly.subTitlesByIdentifier')));
|
||||
$ccPaymentTypes = join(',', array_keys(config('firefly.ccTypes')));
|
||||
|
||||
$nameRule = 'required|min:1|uniqueAccountForUser';
|
||||
$idRule = '';
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use Input;
|
||||
|
||||
@@ -38,11 +37,11 @@ class RuleFormRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
|
||||
$validTriggers = array_keys(Config::get('firefly.rule-triggers'));
|
||||
$validActions = array_keys(Config::get('firefly.rule-actions'));
|
||||
$validTriggers = array_keys(config('firefly.rule-triggers'));
|
||||
$validActions = array_keys(config('firefly.rule-actions'));
|
||||
|
||||
// some actions require text:
|
||||
$contextActions = join(',', Config::get('firefly.rule-actions-text'));
|
||||
$contextActions = join(',', config('firefly.rule-actions-text'));
|
||||
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title';
|
||||
if (RuleGroup::find(Input::get('id'))) {
|
||||
|
@@ -20,7 +20,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
use Auth;
|
||||
use Config;
|
||||
|
||||
/**
|
||||
* Class RuleFormRequest
|
||||
@@ -45,7 +44,7 @@ class TestRuleFormRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
|
||||
$validTriggers = array_keys(Config::get('firefly.rule-triggers'));
|
||||
$validTriggers = array_keys(config('firefly.rule-triggers'));
|
||||
$rules = [
|
||||
'rule-trigger.*' => 'required|min:1|in:' . join(',', $validTriggers),
|
||||
'rule-trigger-value.*' => 'required|min:1|ruleTriggerValue',
|
||||
|
@@ -55,7 +55,7 @@ Breadcrumbs::register(
|
||||
Breadcrumbs::register(
|
||||
'accounts.show', function (BreadCrumbGenerator $breadcrumbs, Account $account) {
|
||||
|
||||
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
|
||||
|
||||
$breadcrumbs->parent('accounts.index', $what);
|
||||
@@ -73,7 +73,7 @@ Breadcrumbs::register(
|
||||
Breadcrumbs::register(
|
||||
'accounts.edit', function (BreadCrumbGenerator $breadcrumbs, Account $account) {
|
||||
$breadcrumbs->parent('accounts.show', $account);
|
||||
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
|
||||
$breadcrumbs->push(trans('firefly.edit_' . $what . '_account', ['name' => e($account->name)]), route('accounts.edit', [$account->id]));
|
||||
}
|
||||
|
Reference in New Issue
Block a user