Code cleanup as described in #1272

This commit is contained in:
James Cole 2018-04-22 17:12:22 +02:00
parent 8032684ad0
commit 36a5f17af2
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
12 changed files with 34 additions and 36 deletions

View File

@ -106,7 +106,7 @@ class ReconcileController extends Controller
if (true !== session('reconcile.edit.fromUpdate')) {
$this->rememberPreviousUri('reconcile.edit.uri');
}
Session::forget('reconcile.edit.fromUpdate');
session()->forget('reconcile.edit.fromUpdate');
return view(
'accounts.reconcile.edit',
@ -444,7 +444,7 @@ class ReconcileController extends Controller
// @codeCoverageIgnoreStart
if (1 === (int)$request->get('return_to_edit')) {
Session::put('reconcile.edit.fromUpdate', true);
session()->put('reconcile.edit.fromUpdate', true);
return redirect(route('accounts.reconcile.edit', [$journal->id]))->withInput(['return_to_edit' => 1]);
}

View File

@ -94,7 +94,7 @@ class UserController extends Controller
if (true !== session('users.edit.fromUpdate')) {
$this->rememberPreviousUri('users.edit.uri');
}
Session::forget('users.edit.fromUpdate');
session()->forget('users.edit.fromUpdate');
$subTitle = (string)trans('firefly.edit_user', ['email' => $user->email]);
$subTitleIcon = 'fa-user-o';
@ -187,7 +187,7 @@ class UserController extends Controller
if (1 === (int)$request->get('return_to_edit')) {
// @codeCoverageIgnoreStart
Session::put('users.edit.fromUpdate', true);
session()->put('users.edit.fromUpdate', true);
return redirect(route('admin.users.edit', [$user->id]))->withInput(['return_to_edit' => 1]);
// @codeCoverageIgnoreEnd

View File

@ -174,6 +174,6 @@ class Controller extends BaseController
*/
protected function rememberPreviousUri(string $identifier)
{
Session::put($identifier, URL::previous());
session()->put($identifier, URL::previous());
}
}

View File

@ -137,7 +137,7 @@ class PiggyBankController extends Controller
if (true !== session('piggy-banks.create.fromStore')) {
$this->rememberPreviousUri('piggy-banks.create.uri');
}
Session::forget('piggy-banks.create.fromStore');
session()->forget('piggy-banks.create.fromStore');
return view('piggy-banks.create', compact('subTitle', 'subTitleIcon'));
}
@ -204,7 +204,7 @@ class PiggyBankController extends Controller
if (true !== session('piggy-banks.edit.fromUpdate')) {
$this->rememberPreviousUri('piggy-banks.edit.uri');
}
Session::forget('piggy-banks.edit.fromUpdate');
session()->forget('piggy-banks.edit.fromUpdate');
return view('piggy-banks.edit', compact('subTitle', 'subTitleIcon', 'piggyBank', 'preFilled'));
}
@ -435,7 +435,7 @@ class PiggyBankController extends Controller
if (1 === (int)$request->get('create_another')) {
// @codeCoverageIgnoreStart
Session::put('piggy-banks.create.fromStore', true);
session()->put('piggy-banks.create.fromStore', true);
return redirect(route('piggy-banks.create'))->withInput();
// @codeCoverageIgnoreEnd
@ -460,7 +460,7 @@ class PiggyBankController extends Controller
if (1 === (int)$request->get('return_to_edit')) {
// @codeCoverageIgnoreStart
Session::put('piggy-banks.edit.fromUpdate', true);
session()->put('piggy-banks.edit.fromUpdate', true);
return redirect(route('piggy-banks.edit', [$piggyBank->id]));
// @codeCoverageIgnoreEnd

View File

@ -105,9 +105,9 @@ class PreferencesController extends Controller
// view range:
Preferences::set('viewRange', $request->get('viewRange'));
// forget session values:
Session::forget('start');
Session::forget('end');
Session::forget('range');
session()->forget('start');
session()->forget('end');
session()->forget('range');
// custom fiscal year
$customFiscalYear = 1 === (int)$request->get('customFiscalYear');

View File

@ -307,7 +307,7 @@ class ProfileController extends Controller
public function postCode(TokenFormRequest $request)
{
Preferences::set('twoFactorAuthEnabled', 1);
Preferences::set('twoFactorAuthSecret', Session::get('two-factor-secret'));
Preferences::set('twoFactorAuthSecret', session()->get('two-factor-secret'));
session()->flash('success', (string)trans('firefly.saved_preferences'));
Preferences::mark();
@ -332,7 +332,7 @@ class ProfileController extends Controller
Log::info(sprintf('User #%d has opted to delete their account', auth()->user()->id));
// make repository delete user:
auth()->logout();
Session::flush();
session()->flush();
$repository->destroy($user);
return redirect(route('index'));

View File

@ -146,7 +146,7 @@ class RuleController extends Controller
if (true !== session('rules.create.fromStore')) {
$this->rememberPreviousUri('rules.create.uri');
}
Session::forget('rules.create.fromStore');
session()->forget('rules.create.fromStore');
return view(
'rules.rule.create',
@ -242,7 +242,7 @@ class RuleController extends Controller
if (true !== session('rules.edit.fromUpdate')) {
$this->rememberPreviousUri('rules.edit.uri');
}
Session::forget('rules.edit.fromUpdate');
session()->forget('rules.edit.fromUpdate');
return view('rules.rule.edit', compact('rule', 'subTitle', 'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount', 'ruleGroups'));
}
@ -370,7 +370,7 @@ class RuleController extends Controller
if (1 === (int)$request->get('create_another')) {
// @codeCoverageIgnoreStart
Session::put('rules.create.fromStore', true);
session()->put('rules.create.fromStore', true);
return redirect(route('rules.create', [$data['rule_group_id']]))->withInput();
// @codeCoverageIgnoreEnd
@ -522,7 +522,7 @@ class RuleController extends Controller
if (1 === (int)$request->get('return_to_edit')) {
// @codeCoverageIgnoreStart
Session::put('rules.edit.fromUpdate', true);
session()->put('rules.edit.fromUpdate', true);
return redirect(route('rules.edit', [$rule->id]))->withInput(['return_to_edit' => 1]);
// @codeCoverageIgnoreEnd

View File

@ -70,7 +70,7 @@ class RuleGroupController extends Controller
if (true !== session('rule-groups.create.fromStore')) {
$this->rememberPreviousUri('rule-groups.create.uri');
}
Session::forget('rule-groups.create.fromStore');
session()->forget('rule-groups.create.fromStore');
return view('rules.rule-group.create', compact('subTitleIcon', 'subTitle'));
}
@ -140,7 +140,7 @@ class RuleGroupController extends Controller
if (true !== session('rule-groups.edit.fromUpdate')) {
$this->rememberPreviousUri('rule-groups.edit.uri');
}
Session::forget('rule-groups.edit.fromUpdate');
session()->forget('rule-groups.edit.fromUpdate');
return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle'));
}
@ -214,7 +214,7 @@ class RuleGroupController extends Controller
if (1 === (int)$request->get('create_another')) {
// @codeCoverageIgnoreStart
Session::put('rule-groups.create.fromStore', true);
session()->put('rule-groups.create.fromStore', true);
return redirect(route('rule-groups.create'))->withInput();
// @codeCoverageIgnoreEnd
@ -258,7 +258,7 @@ class RuleGroupController extends Controller
if (1 === (int)$request->get('return_to_edit')) {
// @codeCoverageIgnoreStart
Session::put('rule-groups.edit.fromUpdate', true);
session()->put('rule-groups.edit.fromUpdate', true);
return redirect(route('rule-groups.edit', [$ruleGroup->id]))->withInput(['return_to_edit' => 1]);
// @codeCoverageIgnoreEnd

View File

@ -86,7 +86,7 @@ class TagController extends Controller
if (true !== session('tags.create.fromStore')) {
$this->rememberPreviousUri('tags.create.uri');
}
Session::forget('tags.create.fromStore');
session()->forget('tags.create.fromStore');
return view('tags.create', compact('subTitle', 'subTitleIcon', 'apiKey'));
}
@ -141,7 +141,7 @@ class TagController extends Controller
if (true !== session('tags.edit.fromUpdate')) {
$this->rememberPreviousUri('tags.edit.uri');
}
Session::forget('tags.edit.fromUpdate');
session()->forget('tags.edit.fromUpdate');
return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'apiKey'));
}
@ -266,7 +266,7 @@ class TagController extends Controller
if (1 === (int)$request->get('create_another')) {
// @codeCoverageIgnoreStart
Session::put('tags.create.fromStore', true);
session()->put('tags.create.fromStore', true);
return redirect(route('tags.create'))->withInput();
// @codeCoverageIgnoreEnd
@ -291,7 +291,7 @@ class TagController extends Controller
if (1 === (int)$request->get('return_to_edit')) {
// @codeCoverageIgnoreStart
Session::put('tags.edit.fromUpdate', true);
session()->put('tags.edit.fromUpdate', true);
return redirect(route('tags.edit', [$tag->id]))->withInput(['return_to_edit' => 1]);
// @codeCoverageIgnoreEnd

View File

@ -30,8 +30,6 @@ use FireflyIII\Http\Requests\BulkEditJournalRequest;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Services\Internal\Update\JournalUpdateService;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Log;
use Preferences;

View File

@ -158,7 +158,7 @@ class SingleController extends Controller
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets());
$piggyBanks = $this->piggyBanks->getPiggyBanksWithAmount();
$piggies = ExpandedForm::makeSelectListWithEmpty($piggyBanks);
$preFilled = Session::has('preFilled') ? session('preFilled') : [];
$preFilled = session()->has('preFilled') ? session('preFilled') : [];
$subTitle = trans('form.add_new_' . $what);
$subTitleIcon = 'fa-plus';
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
@ -171,13 +171,13 @@ class SingleController extends Controller
$preFilled['destination_account_id'] = $source;
}
Session::put('preFilled', $preFilled);
session()->put('preFilled', $preFilled);
// put previous url in session if not redirect from store (not "create another").
if (true !== session('transactions.create.fromStore')) {
$this->rememberPreviousUri('transactions.create.uri');
}
Session::forget('transactions.create.fromStore');
session()->forget('transactions.create.fromStore');
asort($piggies);
@ -318,7 +318,7 @@ class SingleController extends Controller
if (true !== session('transactions.edit.fromUpdate')) {
$this->rememberPreviousUri('transactions.edit.uri');
}
Session::forget('transactions.edit.fromUpdate');
session()->forget('transactions.edit.fromUpdate');
return view(
'transactions.single.edit',
@ -369,7 +369,7 @@ class SingleController extends Controller
// @codeCoverageIgnoreStart
if (true === $createAnother) {
Session::put('transactions.create.fromStore', true);
session()->put('transactions.create.fromStore', true);
return redirect(route('transactions.create', [$request->input('what')]))->withInput();
}
@ -426,7 +426,7 @@ class SingleController extends Controller
// @codeCoverageIgnoreStart
if (1 === (int)$request->get('return_to_edit')) {
Session::put('transactions.edit.fromUpdate', true);
session()->put('transactions.edit.fromUpdate', true);
return redirect(route('transactions.edit', [$journal->id]))->withInput(['return_to_edit' => 1]);
}

View File

@ -122,7 +122,7 @@ class SplitController extends Controller
if (true !== session('transactions.edit-split.fromUpdate')) {
$this->rememberPreviousUri('transactions.edit-split.uri');
}
Session::forget('transactions.edit-split.fromUpdate');
session()->forget('transactions.edit-split.fromUpdate');
return view(
'transactions.split.edit', compact(
@ -170,7 +170,7 @@ class SplitController extends Controller
// @codeCoverageIgnoreStart
if (1 === (int)$request->get('return_to_edit')) {
// set value so edit routine will not overwrite URL:
Session::put('transactions.edit-split.fromUpdate', true);
session()->put('transactions.edit-split.fromUpdate', true);
return redirect(route('transactions.split.edit', [$journal->id]))->withInput(['return_to_edit' => 1]);
}