Reformat various code.

This commit is contained in:
James Cole
2022-03-29 14:56:27 +02:00
parent 9cdaf7076a
commit 1209c4e76a
145 changed files with 472 additions and 472 deletions

View File

@@ -76,10 +76,10 @@ class MoveTransactionsRequest extends FormRequest
if (array_key_exists('original_account', $data) && array_key_exists('destination_account', $data)) {
$repository = app(AccountRepositoryInterface::class);
$repository->setUser(auth()->user());
$original = $repository->find((int)$data['original_account']);
$destination = $repository->find((int)$data['destination_account']);
$original = $repository->find((int) $data['original_account']);
$destination = $repository->find((int) $data['destination_account']);
if ($original->accountType->type !== $destination->accountType->type) {
$validator->errors()->add('title', (string)trans('validation.same_account_type'));
$validator->errors()->add('title', (string) trans('validation.same_account_type'));
return;
}
@@ -87,7 +87,7 @@ class MoveTransactionsRequest extends FormRequest
$originalCurrency = $repository->getAccountCurrency($original);
$destinationCurrency = $repository->getAccountCurrency($destination);
if (null === $originalCurrency xor null === $destinationCurrency) {
$validator->errors()->add('title', (string)trans('validation.same_account_currency'));
$validator->errors()->add('title', (string) trans('validation.same_account_currency'));
return;
}
@@ -96,7 +96,7 @@ class MoveTransactionsRequest extends FormRequest
return;
}
if ($originalCurrency->code !== $destinationCurrency->code) {
$validator->errors()->add('title', (string)trans('validation.same_account_currency'));
$validator->errors()->add('title', (string) trans('validation.same_account_currency'));
}
}
}

View File

@@ -51,7 +51,7 @@ class ExportRequest extends FormRequest
$accounts = new Collection;
foreach ($parts as $part) {
$accountId = (int)$part;
$accountId = (int) $part;
if (0 !== $accountId) {
$account = $repository->find($accountId);
if (null !== $account && AccountType::ASSET === $account->accountType->type) {

View File

@@ -94,7 +94,7 @@ class GenericRequest extends FormRequest
$array = $this->get('accounts');
if (is_array($array)) {
foreach ($array as $accountId) {
$accountId = (int)$accountId;
$accountId = (int) $accountId;
$account = $repository->find($accountId);
if (null !== $account) {
$this->accounts->push($account);
@@ -126,7 +126,7 @@ class GenericRequest extends FormRequest
$array = $this->get('bills');
if (is_array($array)) {
foreach ($array as $billId) {
$billId = (int)$billId;
$billId = (int) $billId;
$bill = $repository->find($billId);
if (null !== $billId) {
$this->bills->push($bill);
@@ -158,7 +158,7 @@ class GenericRequest extends FormRequest
$array = $this->get('budgets');
if (is_array($array)) {
foreach ($array as $budgetId) {
$budgetId = (int)$budgetId;
$budgetId = (int) $budgetId;
$budget = $repository->find($budgetId);
if (null !== $budgetId) {
$this->budgets->push($budget);
@@ -190,7 +190,7 @@ class GenericRequest extends FormRequest
$array = $this->get('categories');
if (is_array($array)) {
foreach ($array as $categoryId) {
$categoryId = (int)$categoryId;
$categoryId = (int) $categoryId;
$category = $repository->find($categoryId);
if (null !== $categoryId) {
$this->categories->push($category);
@@ -280,7 +280,7 @@ class GenericRequest extends FormRequest
$array = $this->get('tags');
if (is_array($array)) {
foreach ($array as $tagId) {
$tagId = (int)$tagId;
$tagId = (int) $tagId;
$tag = $repository->find($tagId);
if (null !== $tagId) {
$this->tags->push($tag);

View File

@@ -90,7 +90,7 @@ class Request extends FormRequest
$start = new Carbon($data['start']);
$end = new Carbon($data['end']);
if ($end->isBefore($start)) {
$validator->errors()->add('end', (string)trans('validation.date_after'));
$validator->errors()->add('end', (string) trans('validation.date_after'));
}
}
}

View File

@@ -104,10 +104,10 @@ class StoreRequest extends FormRequest
$validator->after(
static function (Validator $validator) {
$data = $validator->getData();
$min = (float)($data['amount_min'] ?? 0);
$max = (float)($data['amount_max'] ?? 0);
$min = (float) ($data['amount_min'] ?? 0);
$max = (float) ($data['amount_max'] ?? 0);
if ($min > $max) {
$validator->errors()->add('amount_min', (string)trans('validation.amount_min_over_max'));
$validator->errors()->add('amount_min', (string) trans('validation.amount_min_over_max'));
}
}
);

View File

@@ -105,10 +105,10 @@ class UpdateRequest extends FormRequest
static function (Validator $validator) {
$data = $validator->getData();
if (array_key_exists('amount_min', $data) && array_key_exists('amount_max', $data)) {
$min = (float)($data['amount_min'] ?? 0);
$max = (float)($data['amount_max'] ?? 0);
$min = (float) ($data['amount_min'] ?? 0);
$max = (float) ($data['amount_max'] ?? 0);
if ($min > $max) {
$validator->errors()->add('amount_min', (string)trans('validation.amount_min_over_max'));
$validator->errors()->add('amount_min', (string) trans('validation.amount_min_over_max'));
}
}
}

View File

@@ -90,7 +90,7 @@ class UpdateRequest extends FormRequest
$start = new Carbon($data['start']);
$end = new Carbon($data['end']);
if ($end->isBefore($start)) {
$validator->errors()->add('end', (string)trans('validation.date_after'));
$validator->errors()->add('end', (string) trans('validation.date_after'));
}
}
}

View File

@@ -115,10 +115,10 @@ class StoreRequest extends FormRequest
$current['moment'] = $repetition['moment'];
}
if (array_key_exists('skip', $repetition)) {
$current['skip'] = (int)$repetition['skip'];
$current['skip'] = (int) $repetition['skip'];
}
if (array_key_exists('weekend', $repetition)) {
$current['weekend'] = (int)$repetition['weekend'];
$current['weekend'] = (int) $repetition['weekend'];
}
$return[] = $current;
@@ -135,19 +135,19 @@ class StoreRequest extends FormRequest
public function rules(): array
{
return [
'type' => 'required|in:withdrawal,transfer,deposit',
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
'description' => 'between:1,65000',
'first_date' => 'required|date',
'apply_rules' => [new IsBoolean],
'active' => [new IsBoolean],
'repeat_until' => 'nullable|date',
'nr_of_repetitions' => 'nullable|numeric|between:1,31',
'type' => 'required|in:withdrawal,transfer,deposit',
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
'description' => 'between:1,65000',
'first_date' => 'required|date',
'apply_rules' => [new IsBoolean],
'active' => [new IsBoolean],
'repeat_until' => 'nullable|date',
'nr_of_repetitions' => 'nullable|numeric|between:1,31',
'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly',
'repetitions.*.moment' => 'between:0,10',
'repetitions.*.skip' => 'nullable|numeric|between:0,31',
'repetitions.*.weekend' => 'numeric|min:1|max:4',
'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly',
'repetitions.*.moment' => 'between:0,10',
'repetitions.*.skip' => 'nullable|numeric|between:0,31',
'repetitions.*.weekend' => 'numeric|min:1|max:4',
'transactions.*.description' => 'required|between:1,255',
'transactions.*.amount' => 'required|numeric|gt:0',
@@ -162,11 +162,11 @@ class StoreRequest extends FormRequest
'transactions.*.destination_name' => 'between:1,255|nullable',
// new and updated fields:
'transactions.*.budget_id' => ['nullable','mustExist:budgets,id', new BelongsUser],
'transactions.*.budget_id' => ['nullable', 'mustExist:budgets,id', new BelongsUser],
'transactions.*.budget_name' => ['between:1,255', 'nullable', new BelongsUser],
'transactions.*.category_id' => ['nullable','mustExist:categories,id', new BelongsUser],
'transactions.*.category_id' => ['nullable', 'mustExist:categories,id', new BelongsUser],
'transactions.*.category_name' => 'between:1,255|nullable',
'transactions.*.piggy_bank_id' => ['nullable','numeric', 'mustExist:piggy_banks,id', new BelongsUser],
'transactions.*.piggy_bank_id' => ['nullable', 'numeric', 'mustExist:piggy_banks,id', new BelongsUser],
'transactions.*.piggy_bank_name' => ['between:1,255', 'nullable', new BelongsUser],
'transactions.*.tags' => 'nullable|between:1,64000',
];

View File

@@ -97,15 +97,15 @@ class UpdateRequest extends FormRequest
}
if (array_key_exists('moment', $repetition)) {
$current['moment'] = (string)$repetition['moment'];
$current['moment'] = (string) $repetition['moment'];
}
if (array_key_exists('skip', $repetition)) {
$current['skip'] = (int)$repetition['skip'];
$current['skip'] = (int) $repetition['skip'];
}
if (array_key_exists('weekend', $repetition)) {
$current['weekend'] = (int)$repetition['weekend'];
$current['weekend'] = (int) $repetition['weekend'];
}
$return[] = $current;
}
@@ -150,13 +150,13 @@ class UpdateRequest extends FormRequest
$recurrence = $this->route()->parameter('recurrence');
return [
'title' => sprintf('between:1,255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id),
'description' => 'between:1,65000',
'first_date' => 'date',
'apply_rules' => [new IsBoolean],
'active' => [new IsBoolean],
'repeat_until' => 'nullable|date',
'nr_of_repetitions' => 'nullable|numeric|between:1,31',
'title' => sprintf('between:1,255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id),
'description' => 'between:1,65000',
'first_date' => 'date',
'apply_rules' => [new IsBoolean],
'active' => [new IsBoolean],
'repeat_until' => 'nullable|date',
'nr_of_repetitions' => 'nullable|numeric|between:1,31',
'repetitions.*.type' => 'in:daily,weekly,ndom,monthly,yearly',
'repetitions.*.moment' => 'between:0,10',
@@ -176,11 +176,11 @@ class UpdateRequest extends FormRequest
'transactions.*.destination_name' => 'between:1,255|nullable',
// new and updated fields:
'transactions.*.budget_id' => ['nullable','mustExist:budgets,id', new BelongsUser],
'transactions.*.budget_id' => ['nullable', 'mustExist:budgets,id', new BelongsUser],
'transactions.*.budget_name' => ['between:1,255', 'nullable', new BelongsUser],
'transactions.*.category_id' => ['nullable','mustExist:categories,id', new BelongsUser],
'transactions.*.category_id' => ['nullable', 'mustExist:categories,id', new BelongsUser],
'transactions.*.category_name' => 'between:1,255|nullable',
'transactions.*.piggy_bank_id' => ['nullable','numeric', 'mustExist:piggy_banks,id', new BelongsUser],
'transactions.*.piggy_bank_id' => ['nullable', 'numeric', 'mustExist:piggy_banks,id', new BelongsUser],
'transactions.*.piggy_bank_name' => ['between:1,255', 'nullable', new BelongsUser],
'transactions.*.tags' => 'nullable|between:1,64000',

View File

@@ -76,8 +76,8 @@ class StoreRequest extends FormRequest
$return[] = [
'type' => $trigger['type'],
'value' => $trigger['value'],
'active' => $this->convertBoolean((string)($trigger['active'] ?? 'false')),
'stop_processing' => $this->convertBoolean((string)($trigger['stop_processing'] ?? 'false')),
'active' => $this->convertBoolean((string) ($trigger['active'] ?? 'false')),
'stop_processing' => $this->convertBoolean((string) ($trigger['stop_processing'] ?? 'false')),
];
}
}
@@ -97,8 +97,8 @@ class StoreRequest extends FormRequest
$return[] = [
'type' => $action['type'],
'value' => $action['value'],
'active' => $this->convertBoolean((string)($action['active'] ?? 'false')),
'stop_processing' => $this->convertBoolean((string)($action['stop_processing'] ?? 'false')),
'active' => $this->convertBoolean((string) ($action['active'] ?? 'false')),
'stop_processing' => $this->convertBoolean((string) ($action['stop_processing'] ?? 'false')),
];
}
}
@@ -170,7 +170,22 @@ class StoreRequest extends FormRequest
$triggers = $data['triggers'] ?? [];
// need at least one trigger
if (!is_countable($triggers) || empty($triggers)) {
$validator->errors()->add('title', (string)trans('validation.at_least_one_trigger'));
$validator->errors()->add('title', (string) trans('validation.at_least_one_trigger'));
}
}
/**
* Adds an error to the validator when there are no repetitions in the array of data.
*
* @param Validator $validator
*/
protected function atLeastOneAction(Validator $validator): void
{
$data = $validator->getData();
$actions = $data['actions'] ?? [];
// need at least one trigger
if (!is_countable($actions) || empty($actions)) {
$validator->errors()->add('title', (string) trans('validation.at_least_one_action'));
}
}
@@ -199,7 +214,7 @@ class StoreRequest extends FormRequest
}
}
if (true === $allInactive) {
$validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string)trans('validation.at_least_one_active_trigger'));
$validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger'));
}
}
@@ -228,22 +243,7 @@ class StoreRequest extends FormRequest
}
}
if (true === $allInactive) {
$validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string)trans('validation.at_least_one_active_action'));
}
}
/**
* Adds an error to the validator when there are no repetitions in the array of data.
*
* @param Validator $validator
*/
protected function atLeastOneAction(Validator $validator): void
{
$data = $validator->getData();
$actions = $data['actions'] ?? [];
// need at least one trigger
if (!is_countable($actions) || empty($actions)) {
$validator->errors()->add('title', (string)trans('validation.at_least_one_action'));
$validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action'));
}
}
}

View File

@@ -55,7 +55,7 @@ class TestRequest extends FormRequest
*/
private function getPage(): int
{
return 0 === (int)$this->query('page') ? 1 : (int)$this->query('page');
return 0 === (int) $this->query('page') ? 1 : (int) $this->query('page');
}

View File

@@ -55,7 +55,7 @@ class TriggerRequest extends FormRequest
*/
private function getDate(string $field): ?Carbon
{
return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($this->query($field),0,10));
return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($this->query($field), 0, 10));
}
/**

View File

@@ -110,8 +110,8 @@ class UpdateRequest extends FormRequest
$return[] = [
'type' => $action['type'],
'value' => $action['value'],
'active' => $this->convertBoolean((string)($action['active'] ?? 'false')),
'stop_processing' => $this->convertBoolean((string)($action['stop_processing'] ?? 'false')),
'active' => $this->convertBoolean((string) ($action['active'] ?? 'false')),
'stop_processing' => $this->convertBoolean((string) ($action['stop_processing'] ?? 'false')),
];
}
}
@@ -185,7 +185,7 @@ class UpdateRequest extends FormRequest
$triggers = $data['triggers'] ?? null;
// need at least one trigger
if (is_array($triggers) && empty($triggers)) {
$validator->errors()->add('title', (string)trans('validation.at_least_one_trigger'));
$validator->errors()->add('title', (string) trans('validation.at_least_one_trigger'));
}
}
@@ -214,7 +214,7 @@ class UpdateRequest extends FormRequest
}
}
if (true === $allInactive) {
$validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string)trans('validation.at_least_one_active_trigger'));
$validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger'));
}
}
@@ -229,7 +229,7 @@ class UpdateRequest extends FormRequest
$actions = $data['actions'] ?? null;
// need at least one action
if (is_array($actions) && empty($actions)) {
$validator->errors()->add('title', (string)trans('validation.at_least_one_action'));
$validator->errors()->add('title', (string) trans('validation.at_least_one_action'));
}
}
@@ -259,7 +259,7 @@ class UpdateRequest extends FormRequest
}
}
if (true === $allInactive) {
$validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string)trans('validation.at_least_one_active_action'));
$validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action'));
}
}
}

View File

@@ -80,73 +80,73 @@ class StoreRequest extends FormRequest
$return[] = [
'type' => $this->clearString($object['type'], false),
'date' => $this->dateFromValue($object['date']),
'order' => $this->integerFromValue((string)$object['order']),
'order' => $this->integerFromValue((string) $object['order']),
'currency_id' => $this->integerFromValue((string)$object['currency_id']),
'currency_code' => $this->clearString((string)$object['currency_code'], false),
'currency_id' => $this->integerFromValue((string) $object['currency_id']),
'currency_code' => $this->clearString((string) $object['currency_code'], false),
// foreign currency info:
'foreign_currency_id' => $this->integerFromValue((string)$object['foreign_currency_id']),
'foreign_currency_code' => $this->clearString((string)$object['foreign_currency_code'], false),
'foreign_currency_id' => $this->integerFromValue((string) $object['foreign_currency_id']),
'foreign_currency_code' => $this->clearString((string) $object['foreign_currency_code'], false),
// amount and foreign amount. Cannot be 0.
'amount' => $this->clearString((string)$object['amount'], false),
'foreign_amount' => $this->clearString((string)$object['foreign_amount'], false),
'amount' => $this->clearString((string) $object['amount'], false),
'foreign_amount' => $this->clearString((string) $object['foreign_amount'], false),
// description.
'description' => $this->clearString($object['description'], false),
// source of transaction. If everything is null, assume cash account.
'source_id' => $this->integerFromValue((string)$object['source_id']),
'source_name' => $this->clearString((string)$object['source_name'], false),
'source_iban' => $this->clearString((string)$object['source_iban'], false),
'source_number' => $this->clearString((string)$object['source_number'], false),
'source_bic' => $this->clearString((string)$object['source_bic'], false),
'source_id' => $this->integerFromValue((string) $object['source_id']),
'source_name' => $this->clearString((string) $object['source_name'], false),
'source_iban' => $this->clearString((string) $object['source_iban'], false),
'source_number' => $this->clearString((string) $object['source_number'], false),
'source_bic' => $this->clearString((string) $object['source_bic'], false),
// destination of transaction. If everything is null, assume cash account.
'destination_id' => $this->integerFromValue((string)$object['destination_id']),
'destination_name' => $this->clearString((string)$object['destination_name'], false),
'destination_iban' => $this->clearString((string)$object['destination_iban'], false),
'destination_number' => $this->clearString((string)$object['destination_number'], false),
'destination_bic' => $this->clearString((string)$object['destination_bic'], false),
'destination_id' => $this->integerFromValue((string) $object['destination_id']),
'destination_name' => $this->clearString((string) $object['destination_name'], false),
'destination_iban' => $this->clearString((string) $object['destination_iban'], false),
'destination_number' => $this->clearString((string) $object['destination_number'], false),
'destination_bic' => $this->clearString((string) $object['destination_bic'], false),
// budget info
'budget_id' => $this->integerFromValue((string)$object['budget_id']),
'budget_name' => $this->clearString((string)$object['budget_name'], false),
'budget_id' => $this->integerFromValue((string) $object['budget_id']),
'budget_name' => $this->clearString((string) $object['budget_name'], false),
// category info
'category_id' => $this->integerFromValue((string)$object['category_id']),
'category_name' => $this->clearString((string)$object['category_name'], false),
'category_id' => $this->integerFromValue((string) $object['category_id']),
'category_name' => $this->clearString((string) $object['category_name'], false),
// journal bill reference. Optional. Will only work for withdrawals
'bill_id' => $this->integerFromValue((string)$object['bill_id']),
'bill_name' => $this->clearString((string)$object['bill_name'], false),
'bill_id' => $this->integerFromValue((string) $object['bill_id']),
'bill_name' => $this->clearString((string) $object['bill_name'], false),
// piggy bank reference. Optional. Will only work for transfers
'piggy_bank_id' => $this->integerFromValue((string)$object['piggy_bank_id']),
'piggy_bank_name' => $this->clearString((string)$object['piggy_bank_name'], false),
'piggy_bank_id' => $this->integerFromValue((string) $object['piggy_bank_id']),
'piggy_bank_name' => $this->clearString((string) $object['piggy_bank_name'], false),
// some other interesting properties
'reconciled' => $this->convertBoolean((string)$object['reconciled']),
'notes' => $this->clearString((string)$object['notes']),
'reconciled' => $this->convertBoolean((string) $object['reconciled']),
'notes' => $this->clearString((string) $object['notes']),
'tags' => $this->arrayFromValue($object['tags']),
// all custom fields:
'internal_reference' => $this->clearString((string)$object['internal_reference'], false),
'external_id' => $this->clearString((string)$object['external_id'], false),
'internal_reference' => $this->clearString((string) $object['internal_reference'], false),
'external_id' => $this->clearString((string) $object['external_id'], false),
'original_source' => sprintf('ff3-v%s|api-v%s', config('firefly.version'), config('firefly.api_version')),
'recurrence_id' => $this->integerFromValue($object['recurrence_id']),
'bunq_payment_id' => $this->clearString((string)$object['bunq_payment_id'], false),
'external_url' => $this->clearString((string)$object['external_url'], false),
'bunq_payment_id' => $this->clearString((string) $object['bunq_payment_id'], false),
'external_url' => $this->clearString((string) $object['external_url'], false),
'sepa_cc' => $this->clearString((string)$object['sepa_cc'], false),
'sepa_ct_op' => $this->clearString((string)$object['sepa_ct_op'], false),
'sepa_ct_id' => $this->clearString((string)$object['sepa_ct_id'], false),
'sepa_db' => $this->clearString((string)$object['sepa_db'], false),
'sepa_country' => $this->clearString((string)$object['sepa_country'], false),
'sepa_ep' => $this->clearString((string)$object['sepa_ep'], false),
'sepa_ci' => $this->clearString((string)$object['sepa_ci'], false),
'sepa_batch_id' => $this->clearString((string)$object['sepa_batch_id'], false),
'sepa_cc' => $this->clearString((string) $object['sepa_cc'], false),
'sepa_ct_op' => $this->clearString((string) $object['sepa_ct_op'], false),
'sepa_ct_id' => $this->clearString((string) $object['sepa_ct_id'], false),
'sepa_db' => $this->clearString((string) $object['sepa_db'], false),
'sepa_country' => $this->clearString((string) $object['sepa_country'], false),
'sepa_ep' => $this->clearString((string) $object['sepa_ep'], false),
'sepa_ci' => $this->clearString((string) $object['sepa_ci'], false),
'sepa_batch_id' => $this->clearString((string) $object['sepa_batch_id'], false),
// custom date fields. Must be Carbon objects. Presence is optional.
'interest_date' => $this->dateFromValue($object['interest_date']),
'book_date' => $this->dateFromValue($object['book_date']),
@@ -211,7 +211,7 @@ class StoreRequest extends FormRequest
// budget, category, bill and piggy
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
'transactions.*.budget_name' => ['between:1,255', 'nullable', new BelongsUser],
'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser,'nullable'],
'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser, 'nullable'],
'transactions.*.category_name' => 'between:1,255|nullable',
'transactions.*.bill_id' => ['numeric', 'nullable', 'mustExist:bills,id', new BelongsUser],
'transactions.*.bill_name' => ['between:1,255', 'nullable', new BelongsUser],

View File

@@ -102,8 +102,8 @@ class StoreRequest extends FormRequest
$journalRepos->setUser($user);
$data = $validator->getData();
$inwardId = (int)($data['inward_id'] ?? 0);
$outwardId = (int)($data['outward_id'] ?? 0);
$inwardId = (int) ($data['inward_id'] ?? 0);
$outwardId = (int) ($data['outward_id'] ?? 0);
$inward = $journalRepos->find($inwardId);
$outward = $journalRepos->find($outwardId);

View File

@@ -104,8 +104,8 @@ class UpdateRequest extends FormRequest
$inwardId = $data['inward_id'] ?? $existing->source_id;
$outwardId = $data['outward_id'] ?? $existing->destination_id;
$inward = $journalRepos->find((int)$inwardId);
$outward = $journalRepos->find((int)$outwardId);
$inward = $journalRepos->find((int) $inwardId);
$outward = $journalRepos->find((int) $outwardId);
if (null === $inward) {
$inward = $existing->source;
}

View File

@@ -95,7 +95,7 @@ class UserUpdateRequest extends FormRequest
{
$current = $this->route()->parameter('user');
$validator->after(
static function (Validator $validator) use($current) {
static function (Validator $validator) use ($current) {
$isAdmin = auth()->user()->hasRole('owner');
// not admin, and not own user?
if (auth()->check() && false === $isAdmin && $current?->id !== auth()->user()->id) {

View File

@@ -47,7 +47,7 @@ class PreferenceStoreRequest extends FormRequest
$array['data'] = false;
}
if (is_numeric($array['data'])) {
$array['data'] = (float)$array['data'];
$array['data'] = (float) $array['data'];
}
return $array;

View File

@@ -48,7 +48,7 @@ class PreferenceUpdateRequest extends FormRequest
$array['data'] = false;
}
if (is_numeric($array['data'])) {
$array['data'] = (float)$array['data'];
$array['data'] = (float) $array['data'];
}
return $array;