Code cleanup

This commit is contained in:
James Cole
2021-03-21 09:15:40 +01:00
parent da1751940e
commit 206845575c
317 changed files with 7418 additions and 7362 deletions

View File

@@ -30,8 +30,11 @@ use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\BillStoreRequest;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
/**
* Class CreateController
@@ -52,7 +55,7 @@ class CreateController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('title', (string) trans('firefly.bills'));
app('view')->share('title', (string)trans('firefly.bills'));
app('view')->share('mainTitleIcon', 'fa-calendar-o');
$this->attachments = app(AttachmentHelperInterface::class);
$this->repository = app(BillRepositoryInterface::class);
@@ -67,7 +70,7 @@ class CreateController extends Controller
*
* @param Request $request
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function create(Request $request)
{
@@ -75,9 +78,9 @@ class CreateController extends Controller
/** @var array $billPeriods */
$billPeriods = config('firefly.bill_periods');
foreach ($billPeriods as $current) {
$periods[$current] = (string) trans('firefly.repeat_freq_' . $current);
$periods[$current] = (string)trans('firefly.repeat_freq_' . $current);
}
$subTitle = (string) trans('firefly.create_new_bill');
$subTitle = (string)trans('firefly.create_new_bill');
$defaultCurrency = app('amount')->getDefaultCurrency();
// put previous url in session if not redirect from store (not "create another").
@@ -105,11 +108,11 @@ class CreateController extends Controller
$bill = $this->repository->store($billData);
} catch (FireflyException $e) {
Log::error($e->getMessage());
$request->session()->flash('error', (string) trans('firefly.bill_store_error'));
$request->session()->flash('error', (string)trans('firefly.bill_store_error'));
return redirect(route('bills.create'))->withInput();
}
$request->session()->flash('success', (string) trans('firefly.stored_new_bill', ['name' => $bill->name]));
$request->session()->flash('success', (string)trans('firefly.stored_new_bill', ['name' => $bill->name]));
app('preferences')->mark();
/** @var array $files */
@@ -118,7 +121,7 @@ class CreateController extends Controller
$this->attachments->saveAttachmentsForModel($bill, $files);
}
if (null !== $files && auth()->user()->hasRole('demo')) {
session()->flash('info', (string) trans('firefly.no_att_demo_user'));
session()->flash('info', (string)trans('firefly.no_att_demo_user'));
}
if (count($this->attachments->getMessages()->get('attachments')) > 0) {