/** * @param AccountFormRequest $request * @param ARI $repository * @param Account $account * * @return \Illuminate\Http\RedirectResponse */ public function update(AccountFormRequest $request, ARI $repository, Account $account) { $accountData = ['name' => $request->input('name'), 'active' => $request->input('active'), 'user' => Auth::user()->id, 'iban' => $request->input('iban'), 'accountRole' => $request->input('accountRole'), 'virtualBalance' => round($request->input('virtualBalance'), 2), 'openingBalance' => round($request->input('openingBalance'), 2), 'openingBalanceDate' => new Carbon((string) $request->input('openingBalanceDate')), 'openingBalanceCurrency' => intval($request->input('balance_currency_id')), 'ccType' => $request->input('ccType'), 'ccMonthlyPaymentDate' => $request->input('ccMonthlyPaymentDate')]; $repository->update($account, $accountData); Session::flash('success', 'Account "' . $account->name . '" updated.'); Preferences::mark(); if (intval(Input::get('return_to_edit')) === 1) { // set value so edit routine will not overwrite URL: Session::put('accounts.edit.fromUpdate', true); return redirect(route('accounts.edit', [$account->id]))->withInput(['return_to_edit' => 1]); } // redirect to previous URL. return redirect(Session::get('accounts.edit.url')); }