mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-07-28 00:09:56 -07:00
Autoformat lol
This commit is contained in:
@@ -24,18 +24,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Bill;
|
||||
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\BillUpdateRequest;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
|
||||
/**
|
||||
* Class EditController
|
||||
@@ -43,7 +43,7 @@ use FireflyIII\Support\Facades\Steam;
|
||||
class EditController extends Controller
|
||||
{
|
||||
private AttachmentHelperInterface $attachments;
|
||||
private BillRepositoryInterface $repository;
|
||||
private BillRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* BillController constructor.
|
||||
@@ -52,16 +52,14 @@ class EditController extends Controller
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
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);
|
||||
$this->middleware(function ($request, $next) {
|
||||
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);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
return $next($request);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,16 +67,16 @@ class EditController extends Controller
|
||||
*/
|
||||
public function edit(Request $request, Bill $bill): Factory|View
|
||||
{
|
||||
$periods = [];
|
||||
$periods = [];
|
||||
|
||||
/** @var array $billPeriods */
|
||||
$billPeriods = config('firefly.bill_periods');
|
||||
$billPeriods = config('firefly.bill_periods');
|
||||
|
||||
foreach ($billPeriods as $current) {
|
||||
$periods[$current] = (string) trans('firefly.'.$current);
|
||||
$periods[$current] = (string) trans('firefly.' . $current);
|
||||
}
|
||||
|
||||
$subTitle = (string) trans('firefly.edit_bill', ['name' => $bill->name]);
|
||||
$subTitle = (string) trans('firefly.edit_bill', ['name' => $bill->name]);
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
if (true !== session('bills.edit.fromUpdate')) {
|
||||
@@ -87,24 +85,24 @@ class EditController extends Controller
|
||||
|
||||
$bill->amount_min = Steam::bcround($bill->amount_min, $bill->transactionCurrency->decimal_places);
|
||||
$bill->amount_max = Steam::bcround($bill->amount_max, $bill->transactionCurrency->decimal_places);
|
||||
$rules = $this->repository->getRulesForBill($bill);
|
||||
$rules = $this->repository->getRulesForBill($bill);
|
||||
|
||||
// code to handle active-checkboxes
|
||||
$hasOldInput = null !== $request->old('_token');
|
||||
$hasOldInput = null !== $request->old('_token');
|
||||
|
||||
$preFilled = [
|
||||
$preFilled = [
|
||||
'bill_end_date' => $bill->end_date,
|
||||
'extension_date' => $bill->extension_date,
|
||||
'notes' => $this->repository->getNoteText($bill),
|
||||
'transaction_currency_id' => $bill->transaction_currency_id,
|
||||
'active' => $hasOldInput ? (bool) $request->old('active') : $bill->active,
|
||||
'object_group' => null !== $bill->objectGroups->first() ? $bill->objectGroups->first()->title : '',
|
||||
'object_group' => null !== $bill->objectGroups->first() ? $bill->objectGroups->first()->title : ''
|
||||
];
|
||||
|
||||
$request->session()->flash('preFilled', $preFilled);
|
||||
$request->session()->forget('bills.edit.fromUpdate');
|
||||
|
||||
return view('bills.edit', ['subTitle' => $subTitle, 'periods' => $periods, 'rules' => $rules, 'bill' => $bill, 'preFilled' => $preFilled]);
|
||||
return view('bills.edit', ['subTitle' => $subTitle, 'periods' => $periods, 'rules' => $rules, 'bill' => $bill, 'preFilled' => $preFilled]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +119,7 @@ class EditController extends Controller
|
||||
Preferences::mark();
|
||||
|
||||
/** @var null|array $files */
|
||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||
if (null !== $files && !auth()->user()->hasRole('demo')) {
|
||||
$this->attachments->saveAttachmentsForModel($bill, $files);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user