From 2b615cf757268912bdafa7df9a41e02c82df4d27 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 2 May 2022 19:35:35 +0200 Subject: [PATCH] Fix bad call to method. --- .../Autocomplete/AutocompleteRequest.php | 4 +- .../V1/Requests/Data/Export/ExportRequest.php | 4 +- .../Requests/Models/Account/StoreRequest.php | 34 ++++++++--------- .../Requests/Models/Account/UpdateRequest.php | 4 +- .../Models/Attachment/StoreRequest.php | 8 ++-- .../Models/Attachment/UpdateRequest.php | 2 +- .../Models/BudgetLimit/StoreRequest.php | 4 +- .../Requests/Models/Category/StoreRequest.php | 2 +- .../Models/PiggyBank/StoreRequest.php | 8 ++-- .../Models/RuleGroup/StoreRequest.php | 4 +- .../V1/Requests/Models/Tag/StoreRequest.php | 4 +- .../Models/Transaction/StoreRequest.php | 2 +- .../Models/Transaction/UpdateRequest.php | 6 +-- .../TransactionCurrency/StoreRequest.php | 6 +-- .../Models/TransactionLink/StoreRequest.php | 2 +- .../Models/TransactionLink/UpdateRequest.php | 2 +- .../TransactionLinkType/StoreRequest.php | 6 +-- .../TransactionLinkType/UpdateRequest.php | 6 +-- .../Requests/Models/Webhook/UpdateRequest.php | 2 +- app/Api/V1/Requests/System/UpdateRequest.php | 2 +- .../V1/Requests/System/UserStoreRequest.php | 6 +-- .../V1/Requests/System/UserUpdateRequest.php | 6 +-- .../Requests/User/PreferenceStoreRequest.php | 2 +- .../Requests/User/PreferenceUpdateRequest.php | 2 +- app/Http/Controllers/Admin/LinkController.php | 12 +++--- app/Http/Controllers/NewUserController.php | 2 +- app/Http/Controllers/ProfileController.php | 2 +- .../Controllers/RuleGroup/EditController.php | 2 +- .../Transaction/BulkController.php | 4 +- app/Http/Requests/AccountFormRequest.php | 28 +++++++------- app/Http/Requests/AttachmentFormRequest.php | 4 +- app/Http/Requests/BillStoreRequest.php | 10 ++--- app/Http/Requests/BillUpdateRequest.php | 10 ++--- app/Http/Requests/BudgetFormStoreRequest.php | 6 +-- app/Http/Requests/BudgetFormUpdateRequest.php | 6 +-- app/Http/Requests/CategoryFormRequest.php | 2 +- app/Http/Requests/CurrencyFormRequest.php | 6 +-- app/Http/Requests/JournalLinkRequest.php | 2 +- app/Http/Requests/ObjectGroupFormRequest.php | 2 +- app/Http/Requests/PiggyBankStoreRequest.php | 6 +-- app/Http/Requests/PiggyBankUpdateRequest.php | 6 +-- .../Requests/ReconciliationStoreRequest.php | 8 ++-- app/Http/Requests/RecurrenceFormRequest.php | 38 +++++++++---------- app/Http/Requests/RuleFormRequest.php | 4 +- app/Http/Requests/RuleGroupFormRequest.php | 2 +- app/Http/Requests/TagFormRequest.php | 4 +- app/Http/Requests/UserFormRequest.php | 6 +-- app/Support/Request/AppendsLocationData.php | 12 +++--- app/Support/Request/ConvertsDataTypes.php | 2 +- 49 files changed, 157 insertions(+), 157 deletions(-) diff --git a/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php b/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php index be5ed5b0d8..058f9dc05b 100644 --- a/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php +++ b/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php @@ -40,7 +40,7 @@ class AutocompleteRequest extends FormRequest */ public function getData(): array { - $types = $this->string('types'); + $types = $this->convertString('types'); $array = []; if ('' !== $types) { $array = explode(',', $types); @@ -53,7 +53,7 @@ class AutocompleteRequest extends FormRequest return [ 'types' => $array, - 'query' => $this->string('query'), + 'query' => $this->convertString('query'), 'date' => $this->getCarbonDate('date'), 'limit' => $limit, ]; diff --git a/app/Api/V1/Requests/Data/Export/ExportRequest.php b/app/Api/V1/Requests/Data/Export/ExportRequest.php index 8d27d6c8ed..0ada44dce7 100644 --- a/app/Api/V1/Requests/Data/Export/ExportRequest.php +++ b/app/Api/V1/Requests/Data/Export/ExportRequest.php @@ -43,9 +43,9 @@ class ExportRequest extends FormRequest $result = [ 'start' => $this->getCarbonDate('start') ?? Carbon::now()->subYear(), 'end' => $this->getCarbonDate('end') ?? Carbon::now(), - 'type' => $this->string('type'), + 'type' => $this->convertString('type'), ]; - $parts = explode(',', $this->string('accounts')); + $parts = explode(',', $this->convertString('accounts')); $repository = app(AccountRepositoryInterface::class); $repository->setUser(auth()->user()); diff --git a/app/Api/V1/Requests/Models/Account/StoreRequest.php b/app/Api/V1/Requests/Models/Account/StoreRequest.php index 443dbb2fae..2da7798692 100644 --- a/app/Api/V1/Requests/Models/Account/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Account/StoreRequest.php @@ -56,35 +56,35 @@ class StoreRequest extends FormRequest $includeNetWorth = $this->boolean('include_net_worth'); } $data = [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'active' => $active, 'include_net_worth' => $includeNetWorth, - 'account_type_name' => $this->string('type'), + 'account_type_name' => $this->convertString('type'), 'account_type_id' => null, 'currency_id' => $this->integer('currency_id'), 'order' => $this->integer('order'), - 'currency_code' => $this->string('currency_code'), - 'virtual_balance' => $this->string('virtual_balance'), - 'iban' => $this->string('iban'), - 'BIC' => $this->string('bic'), - 'account_number' => $this->string('account_number'), - 'account_role' => $this->string('account_role'), - 'opening_balance' => $this->string('opening_balance'), + 'currency_code' => $this->convertString('currency_code'), + 'virtual_balance' => $this->convertString('virtual_balance'), + 'iban' => $this->convertString('iban'), + 'BIC' => $this->convertString('bic'), + 'account_number' => $this->convertString('account_number'), + 'account_role' => $this->convertString('account_role'), + 'opening_balance' => $this->convertString('opening_balance'), 'opening_balance_date' => $this->getCarbonDate('opening_balance_date'), - 'cc_type' => $this->string('credit_card_type'), - 'cc_monthly_payment_date' => $this->string('monthly_payment_date'), + 'cc_type' => $this->convertString('credit_card_type'), + 'cc_monthly_payment_date' => $this->convertString('monthly_payment_date'), 'notes' => $this->stringWithNewlines('notes'), - 'interest' => $this->string('interest'), - 'interest_period' => $this->string('interest_period'), + 'interest' => $this->convertString('interest'), + 'interest_period' => $this->convertString('interest_period'), ]; // append location information. $data = $this->appendLocationData($data, null); if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) { - $data['opening_balance'] = app('steam')->negative($this->string('liability_amount')); + $data['opening_balance'] = app('steam')->negative($this->convertString('liability_amount')); $data['opening_balance_date'] = $this->getCarbonDate('liability_start_date'); - $data['account_type_name'] = $this->string('liability_type'); - $data['liability_direction'] = $this->string('liability_direction'); + $data['account_type_name'] = $this->convertString('liability_type'); + $data['liability_direction'] = $this->convertString('liability_direction'); $data['account_type_id'] = null; } @@ -101,7 +101,7 @@ class StoreRequest extends FormRequest $accountRoles = implode(',', config('firefly.accountRoles')); $types = implode(',', array_keys(config('firefly.subTitlesByIdentifier'))); $ccPaymentTypes = implode(',', array_keys(config('firefly.ccTypes'))); - $type = $this->string('type'); + $type = $this->convertString('type'); $rules = [ 'name' => 'required|min:1|uniqueAccountForUser', 'type' => 'required|' . sprintf('in:%s', $types), diff --git a/app/Api/V1/Requests/Models/Account/UpdateRequest.php b/app/Api/V1/Requests/Models/Account/UpdateRequest.php index d2d63e80bf..abb5f1cc59 100644 --- a/app/Api/V1/Requests/Models/Account/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Account/UpdateRequest.php @@ -107,9 +107,9 @@ class UpdateRequest extends FormRequest $rules = [ 'name' => sprintf('min:1|uniqueAccountForUser:%d', $account->id), 'type' => sprintf('in:%s', $types), - 'iban' => ['iban', 'nullable', new UniqueIban($account, $this->string('type'))], + 'iban' => ['iban', 'nullable', new UniqueIban($account, $this->convertString('type'))], 'bic' => 'bic|nullable', - 'account_number' => ['between:1,255', 'nullable', new UniqueAccountNumber($account, $this->string('type'))], + 'account_number' => ['between:1,255', 'nullable', new UniqueAccountNumber($account, $this->convertString('type'))], 'opening_balance' => 'numeric|required_with:opening_balance_date|nullable', 'opening_balance_date' => 'date|required_with:opening_balance|nullable', 'virtual_balance' => 'numeric|nullable', diff --git a/app/Api/V1/Requests/Models/Attachment/StoreRequest.php b/app/Api/V1/Requests/Models/Attachment/StoreRequest.php index be13081ab8..0099f69146 100644 --- a/app/Api/V1/Requests/Models/Attachment/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Attachment/StoreRequest.php @@ -45,10 +45,10 @@ class StoreRequest extends FormRequest public function getAll(): array { return [ - 'filename' => $this->string('filename'), - 'title' => $this->string('title'), + 'filename' => $this->convertString('filename'), + 'title' => $this->convertString('title'), 'notes' => $this->stringWithNewlines('notes'), - 'attachable_type' => $this->string('attachable_type'), + 'attachable_type' => $this->convertString('attachable_type'), 'attachable_id' => $this->integer('attachable_id'), ]; } @@ -68,7 +68,7 @@ class StoreRequest extends FormRequest }, $models ); $models = implode(',', $models); - $model = $this->string('attachable_type'); + $model = $this->convertString('attachable_type'); return [ 'filename' => 'required|between:1,255', diff --git a/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php b/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php index cb05b390bd..e0d3092663 100644 --- a/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php @@ -70,7 +70,7 @@ class UpdateRequest extends FormRequest }, $models ); $models = implode(',', $models); - $model = $this->string('attachable_type'); + $model = $this->convertString('attachable_type'); return [ 'filename' => 'between:1,255', diff --git a/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php b/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php index e2e777430c..944ac431aa 100644 --- a/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php +++ b/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php @@ -46,9 +46,9 @@ class StoreRequest extends FormRequest return [ 'start' => $this->getCarbonDate('start'), 'end' => $this->getCarbonDate('end'), - 'amount' => $this->string('amount'), + 'amount' => $this->convertString('amount'), 'currency_id' => $this->integer('currency_id'), - 'currency_code' => $this->string('currency_code'), + 'currency_code' => $this->convertString('currency_code'), ]; } diff --git a/app/Api/V1/Requests/Models/Category/StoreRequest.php b/app/Api/V1/Requests/Models/Category/StoreRequest.php index b6f96bfdc9..bebfee1438 100644 --- a/app/Api/V1/Requests/Models/Category/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Category/StoreRequest.php @@ -45,7 +45,7 @@ class StoreRequest extends FormRequest public function getAll(): array { return [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'notes' => $this->stringWithNewlines('notes'), ]; } diff --git a/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php b/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php index 6c06445067..aab5cfee20 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php @@ -47,15 +47,15 @@ class StoreRequest extends FormRequest 'order' => ['order', 'integer'], ]; $data = $this->getAllData($fields); - $data['name'] = $this->string('name'); + $data['name'] = $this->convertString('name'); $data['account_id'] = $this->integer('account_id'); - $data['targetamount'] = $this->string('target_amount'); - $data['current_amount'] = $this->string('current_amount'); + $data['targetamount'] = $this->convertString('target_amount'); + $data['current_amount'] = $this->convertString('current_amount'); $data['startdate'] = $this->getCarbonDate('start_date'); $data['targetdate'] = $this->getCarbonDate('target_date'); $data['notes'] = $this->stringWithNewlines('notes'); $data['object_group_id'] = $this->integer('object_group_id'); - $data['object_group_title'] = $this->string('object_group_title'); + $data['object_group_title'] = $this->convertString('object_group_title'); return $data; diff --git a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php index 54a535882f..5bb4904cd2 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php @@ -53,8 +53,8 @@ class StoreRequest extends FormRequest } return [ - 'title' => $this->string('title'), - 'description' => $this->string('description'), + 'title' => $this->convertString('title'), + 'description' => $this->convertString('description'), 'active' => $active, 'order' => $order, ]; diff --git a/app/Api/V1/Requests/Models/Tag/StoreRequest.php b/app/Api/V1/Requests/Models/Tag/StoreRequest.php index 6b513051d2..01ac8cb5c4 100644 --- a/app/Api/V1/Requests/Models/Tag/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Tag/StoreRequest.php @@ -46,9 +46,9 @@ class StoreRequest extends FormRequest public function getAll(): array { $data = [ - 'tag' => $this->string('tag'), + 'tag' => $this->convertString('tag'), 'date' => $this->getCarbonDate('date'), - 'description' => $this->string('description'), + 'description' => $this->convertString('description'), 'has_location' => true, ]; diff --git a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php index 69c44249dc..b1306b8454 100644 --- a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php @@ -55,7 +55,7 @@ class StoreRequest extends FormRequest Log::debug('get all data in TransactionStoreRequest'); return [ - 'group_title' => $this->string('group_title'), + 'group_title' => $this->convertString('group_title'), 'error_if_duplicate_hash' => $this->boolean('error_if_duplicate_hash'), 'apply_rules' => $this->boolean('apply_rules', true), 'fire_webhooks' => $this->boolean('fire_webhooks', true), diff --git a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php index c63e344a6f..54bc859473 100644 --- a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php @@ -84,7 +84,7 @@ class UpdateRequest extends FormRequest 'notes', ]; - $this->stringFields = [ + $this->convertStringFields = [ 'type', 'currency_code', 'foreign_currency_code', @@ -133,7 +133,7 @@ class UpdateRequest extends FormRequest $data['fire_webhooks'] = $this->boolean('fire_webhooks', true); } if ($this->has('group_title')) { - $data['group_title'] = $this->string('group_title'); + $data['group_title'] = $this->convertString('group_title'); } return $data; @@ -196,7 +196,7 @@ class UpdateRequest extends FormRequest */ private function getStringData(array $current, array $transaction): array { - foreach ($this->stringFields as $fieldName) { + foreach ($this->convertStringFields as $fieldName) { if (array_key_exists($fieldName, $transaction)) { $current[$fieldName] = $this->clearString((string) $transaction[$fieldName], false); } diff --git a/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php index 79edc08b95..b7995396cf 100644 --- a/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php @@ -54,9 +54,9 @@ class StoreRequest extends FormRequest } return [ - 'name' => $this->string('name'), - 'code' => $this->string('code'), - 'symbol' => $this->string('symbol'), + 'name' => $this->convertString('name'), + 'code' => $this->convertString('code'), + 'symbol' => $this->convertString('symbol'), 'decimal_places' => $this->integer('decimal_places'), 'default' => $default, 'enabled' => $enabled, diff --git a/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php index f9db392594..07763da9c4 100644 --- a/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php @@ -47,7 +47,7 @@ class StoreRequest extends FormRequest { return [ 'link_type_id' => $this->integer('link_type_id'), - 'link_type_name' => $this->string('link_type_name'), + 'link_type_name' => $this->convertString('link_type_name'), 'inward_id' => $this->integer('inward_id'), 'outward_id' => $this->integer('outward_id'), 'notes' => $this->stringWithNewlines('notes'), diff --git a/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php b/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php index ddfbd7fd50..a70ffa34ea 100644 --- a/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php @@ -47,7 +47,7 @@ class UpdateRequest extends FormRequest { return [ 'link_type_id' => $this->integer('link_type_id'), - 'link_type_name' => $this->string('link_type_name'), + 'link_type_name' => $this->convertString('link_type_name'), 'inward_id' => $this->integer('inward_id'), 'outward_id' => $this->integer('outward_id'), 'notes' => $this->stringWithNewlines('notes'), diff --git a/app/Api/V1/Requests/Models/TransactionLinkType/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionLinkType/StoreRequest.php index 1d301fdbb5..5226968de4 100644 --- a/app/Api/V1/Requests/Models/TransactionLinkType/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLinkType/StoreRequest.php @@ -44,9 +44,9 @@ class StoreRequest extends FormRequest public function getAll(): array { return [ - 'name' => $this->string('name'), - 'outward' => $this->string('outward'), - 'inward' => $this->string('inward'), + 'name' => $this->convertString('name'), + 'outward' => $this->convertString('outward'), + 'inward' => $this->convertString('inward'), ]; } diff --git a/app/Api/V1/Requests/Models/TransactionLinkType/UpdateRequest.php b/app/Api/V1/Requests/Models/TransactionLinkType/UpdateRequest.php index cbc2a988f6..54036336bd 100644 --- a/app/Api/V1/Requests/Models/TransactionLinkType/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLinkType/UpdateRequest.php @@ -45,9 +45,9 @@ class UpdateRequest extends FormRequest public function getAll(): array { return [ - 'name' => $this->string('name'), - 'outward' => $this->string('outward'), - 'inward' => $this->string('inward'), + 'name' => $this->convertString('name'), + 'outward' => $this->convertString('outward'), + 'inward' => $this->convertString('inward'), ]; } diff --git a/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php b/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php index 6adc6a0880..b5ea3eb5c9 100644 --- a/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php @@ -66,7 +66,7 @@ class UpdateRequest extends FormRequest } $return['secret'] = null !== $this->get('secret'); if (null !== $this->get('title')) { - $return['title'] = $this->string('title'); + $return['title'] = $this->convertString('title'); } return $return; diff --git a/app/Api/V1/Requests/System/UpdateRequest.php b/app/Api/V1/Requests/System/UpdateRequest.php index 17c009f9a9..5d96d360b8 100644 --- a/app/Api/V1/Requests/System/UpdateRequest.php +++ b/app/Api/V1/Requests/System/UpdateRequest.php @@ -57,7 +57,7 @@ class UpdateRequest extends FormRequest return ['value' => $this->integer('value')]; } - return ['value' => $this->string('value')]; + return ['value' => $this->convertString('value')]; } /** diff --git a/app/Api/V1/Requests/System/UserStoreRequest.php b/app/Api/V1/Requests/System/UserStoreRequest.php index a2e4ff67ec..7168bc4555 100644 --- a/app/Api/V1/Requests/System/UserStoreRequest.php +++ b/app/Api/V1/Requests/System/UserStoreRequest.php @@ -59,10 +59,10 @@ class UserStoreRequest extends FormRequest } return [ - 'email' => $this->string('email'), + 'email' => $this->convertString('email'), 'blocked' => $blocked, - 'blocked_code' => $this->string('blocked_code'), - 'role' => $this->string('role'), + 'blocked_code' => $this->convertString('blocked_code'), + 'role' => $this->convertString('role'), ]; } diff --git a/app/Api/V1/Requests/System/UserUpdateRequest.php b/app/Api/V1/Requests/System/UserUpdateRequest.php index adb44107ab..1433467ce2 100644 --- a/app/Api/V1/Requests/System/UserUpdateRequest.php +++ b/app/Api/V1/Requests/System/UserUpdateRequest.php @@ -60,10 +60,10 @@ class UserUpdateRequest extends FormRequest } return [ - 'email' => $this->string('email'), + 'email' => $this->convertString('email'), 'blocked' => $blocked, - 'blocked_code' => $this->string('blocked_code'), - 'role' => $this->string('role'), + 'blocked_code' => $this->convertString('blocked_code'), + 'role' => $this->convertString('role'), ]; } diff --git a/app/Api/V1/Requests/User/PreferenceStoreRequest.php b/app/Api/V1/Requests/User/PreferenceStoreRequest.php index 18f513fd85..e652950b25 100644 --- a/app/Api/V1/Requests/User/PreferenceStoreRequest.php +++ b/app/Api/V1/Requests/User/PreferenceStoreRequest.php @@ -37,7 +37,7 @@ class PreferenceStoreRequest extends FormRequest public function getAll(): array { $array = [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'data' => $this->get('data'), ]; if ('true' === $array['data']) { diff --git a/app/Api/V1/Requests/User/PreferenceUpdateRequest.php b/app/Api/V1/Requests/User/PreferenceUpdateRequest.php index 0c6d66bd4f..7f389c872e 100644 --- a/app/Api/V1/Requests/User/PreferenceUpdateRequest.php +++ b/app/Api/V1/Requests/User/PreferenceUpdateRequest.php @@ -38,7 +38,7 @@ class PreferenceUpdateRequest extends FormRequest public function getAll(): array { $array = [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'data' => $this->get('data'), ]; if ('true' === $array['data']) { diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php index 2104abcc6e..5cda12b263 100644 --- a/app/Http/Controllers/Admin/LinkController.php +++ b/app/Http/Controllers/Admin/LinkController.php @@ -217,9 +217,9 @@ class LinkController extends Controller public function store(LinkTypeFormRequest $request) { $data = [ - 'name' => $request->string('name'), - 'inward' => $request->string('inward'), - 'outward' => $request->string('outward'), + 'name' => $request->convertString('name'), + 'inward' => $request->convertString('inward'), + 'outward' => $request->convertString('outward'), ]; $linkType = $this->repository->store($data); @@ -255,9 +255,9 @@ class LinkController extends Controller } $data = [ - 'name' => $request->string('name'), - 'inward' => $request->string('inward'), - 'outward' => $request->string('outward'), + 'name' => $request->convertString('name'), + 'inward' => $request->convertString('inward'), + 'outward' => $request->convertString('outward'), ]; $this->repository->update($linkType, $data); diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index 4bd8c84a9e..e0c3ab04e7 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -92,7 +92,7 @@ class NewUserController extends Controller */ public function submit(NewUserFormRequest $request, CurrencyRepositoryInterface $currencyRepository) { - $language = $request->string('language'); + $language = $request->convertString('language'); if (!array_key_exists($language, config('firefly.languages'))) { $language = 'en_US'; diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 9ec9402403..5ad9dc473e 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -410,7 +410,7 @@ class ProfileController extends Controller /** @var User $user */ $user = auth()->user(); - $newEmail = $request->string('email'); + $newEmail = $request->convertString('email'); $oldEmail = $user->email; if ($newEmail === $user->email) { session()->flash('error', (string) trans('firefly.email_not_changed')); diff --git a/app/Http/Controllers/RuleGroup/EditController.php b/app/Http/Controllers/RuleGroup/EditController.php index 360a19362e..a6bbf7ce67 100644 --- a/app/Http/Controllers/RuleGroup/EditController.php +++ b/app/Http/Controllers/RuleGroup/EditController.php @@ -131,7 +131,7 @@ class EditController extends Controller public function update(RuleGroupFormRequest $request, RuleGroup $ruleGroup) { $data = [ - 'title' => $request->string('title'), + 'title' => $request->convertString('title'), 'description' => $request->stringWithNewlines('description'), 'active' => 1 === (int) $request->input('active'), ]; diff --git a/app/Http/Controllers/Transaction/BulkController.php b/app/Http/Controllers/Transaction/BulkController.php index 975345da44..c7395e2c5f 100644 --- a/app/Http/Controllers/Transaction/BulkController.php +++ b/app/Http/Controllers/Transaction/BulkController.php @@ -110,8 +110,8 @@ class BulkController extends Controller $journal = $this->repository->find($journalId); if (null !== $journal) { $resultA = $this->updateJournalBudget($journal, $ignoreBudget, $request->integer('budget_id')); - $resultB = $this->updateJournalTags($journal, $tagsAction, explode(',', $request->string('tags'))); - $resultC = $this->updateJournalCategory($journal, $ignoreCategory, $request->string('category')); + $resultB = $this->updateJournalTags($journal, $tagsAction, explode(',', $request->convertString('tags'))); + $resultC = $this->updateJournalCategory($journal, $ignoreCategory, $request->convertString('category')); if ($resultA || $resultB || $resultC) { $count++; } diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php index cc13497c19..c003facbd9 100644 --- a/app/Http/Requests/AccountFormRequest.php +++ b/app/Http/Requests/AccountFormRequest.php @@ -45,24 +45,24 @@ class AccountFormRequest extends FormRequest public function getAccountData(): array { $data = [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'active' => $this->boolean('active'), - 'account_type_name' => $this->string('objectType'), + 'account_type_name' => $this->convertString('objectType'), 'currency_id' => $this->integer('currency_id'), - 'virtual_balance' => $this->string('virtual_balance'), - 'iban' => $this->string('iban'), - 'BIC' => $this->string('BIC'), - 'account_number' => $this->string('account_number'), - 'account_role' => $this->string('account_role'), - 'opening_balance' => $this->string('opening_balance'), + 'virtual_balance' => $this->convertString('virtual_balance'), + 'iban' => $this->convertString('iban'), + 'BIC' => $this->convertString('BIC'), + 'account_number' => $this->convertString('account_number'), + 'account_role' => $this->convertString('account_role'), + 'opening_balance' => $this->convertString('opening_balance'), 'opening_balance_date' => $this->getCarbonDate('opening_balance_date'), - 'cc_type' => $this->string('cc_type'), - 'cc_monthly_payment_date' => $this->string('cc_monthly_payment_date'), + 'cc_type' => $this->convertString('cc_type'), + 'cc_monthly_payment_date' => $this->convertString('cc_monthly_payment_date'), 'notes' => $this->stringWithNewlines('notes'), - 'interest' => $this->string('interest'), - 'interest_period' => $this->string('interest_period'), + 'interest' => $this->convertString('interest'), + 'interest_period' => $this->convertString('interest_period'), 'include_net_worth' => '1', - 'liability_direction' => $this->string('liability_direction'), + 'liability_direction' => $this->convertString('liability_direction'), ]; $data = $this->appendLocationData($data, 'location'); @@ -100,7 +100,7 @@ class AccountFormRequest extends FormRequest 'name' => 'required|min:1|uniqueAccountForUser', 'opening_balance' => 'numeric|nullable|max:1000000000', 'opening_balance_date' => 'date|required_with:opening_balance|nullable', - 'iban' => ['iban', 'nullable', new UniqueIban(null, $this->string('objectType'))], + 'iban' => ['iban', 'nullable', new UniqueIban(null, $this->convertString('objectType'))], 'BIC' => 'bic|nullable', 'virtual_balance' => 'numeric|nullable|max:1000000000', 'currency_id' => 'exists:transaction_currencies,id', diff --git a/app/Http/Requests/AttachmentFormRequest.php b/app/Http/Requests/AttachmentFormRequest.php index 4037ca1370..dd03ba124b 100644 --- a/app/Http/Requests/AttachmentFormRequest.php +++ b/app/Http/Requests/AttachmentFormRequest.php @@ -43,8 +43,8 @@ class AttachmentFormRequest extends FormRequest public function getAttachmentData(): array { return [ - 'title' => $this->string('title'), - 'notes' => $this->string('notes'), + 'title' => $this->convertString('title'), + 'notes' => $this->convertString('notes'), ]; } diff --git a/app/Http/Requests/BillStoreRequest.php b/app/Http/Requests/BillStoreRequest.php index ec1d0f1077..ebe3dd03fb 100644 --- a/app/Http/Requests/BillStoreRequest.php +++ b/app/Http/Requests/BillStoreRequest.php @@ -41,19 +41,19 @@ class BillStoreRequest extends FormRequest public function getBillData(): array { return [ - 'name' => $this->string('name'), - 'amount_min' => $this->string('amount_min'), + 'name' => $this->convertString('name'), + 'amount_min' => $this->convertString('amount_min'), 'currency_id' => $this->integer('transaction_currency_id'), 'currency_code' => '', - 'amount_max' => $this->string('amount_max'), + 'amount_max' => $this->convertString('amount_max'), 'date' => $this->getCarbonDate('date'), 'end_date' => $this->getCarbonDate('bill_end_date'), 'extension_date' => $this->getCarbonDate('extension_date'), - 'repeat_freq' => $this->string('repeat_freq'), + 'repeat_freq' => $this->convertString('repeat_freq'), 'skip' => $this->integer('skip'), 'notes' => $this->stringWithNewlines('notes'), 'active' => $this->boolean('active'), - 'object_group_title' => $this->string('object_group'), + 'object_group_title' => $this->convertString('object_group'), ]; } diff --git a/app/Http/Requests/BillUpdateRequest.php b/app/Http/Requests/BillUpdateRequest.php index 359dfc7bf0..258647741d 100644 --- a/app/Http/Requests/BillUpdateRequest.php +++ b/app/Http/Requests/BillUpdateRequest.php @@ -42,19 +42,19 @@ class BillUpdateRequest extends FormRequest public function getBillData(): array { return [ - 'name' => $this->string('name'), - 'amount_min' => $this->string('amount_min'), + 'name' => $this->convertString('name'), + 'amount_min' => $this->convertString('amount_min'), 'currency_id' => $this->integer('transaction_currency_id'), 'currency_code' => '', - 'amount_max' => $this->string('amount_max'), + 'amount_max' => $this->convertString('amount_max'), 'date' => $this->getCarbonDate('date'), 'end_date' => $this->getCarbonDate('bill_end_date'), 'extension_date' => $this->getCarbonDate('extension_date'), - 'repeat_freq' => $this->string('repeat_freq'), + 'repeat_freq' => $this->convertString('repeat_freq'), 'skip' => $this->integer('skip'), 'notes' => $this->stringWithNewlines('notes'), 'active' => $this->boolean('active'), - 'object_group_title' => $this->string('object_group'), + 'object_group_title' => $this->convertString('object_group'), ]; } diff --git a/app/Http/Requests/BudgetFormStoreRequest.php b/app/Http/Requests/BudgetFormStoreRequest.php index 945497b671..abf43f34be 100644 --- a/app/Http/Requests/BudgetFormStoreRequest.php +++ b/app/Http/Requests/BudgetFormStoreRequest.php @@ -44,12 +44,12 @@ class BudgetFormStoreRequest extends FormRequest public function getBudgetData(): array { return [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'active' => $this->boolean('active'), 'auto_budget_type' => $this->integer('auto_budget_type'), 'currency_id' => $this->integer('auto_budget_currency_id'), - 'auto_budget_amount' => $this->string('auto_budget_amount'), - 'auto_budget_period' => $this->string('auto_budget_period'), + 'auto_budget_amount' => $this->convertString('auto_budget_amount'), + 'auto_budget_period' => $this->convertString('auto_budget_period'), ]; } diff --git a/app/Http/Requests/BudgetFormUpdateRequest.php b/app/Http/Requests/BudgetFormUpdateRequest.php index e3e567db81..93902889af 100644 --- a/app/Http/Requests/BudgetFormUpdateRequest.php +++ b/app/Http/Requests/BudgetFormUpdateRequest.php @@ -45,12 +45,12 @@ class BudgetFormUpdateRequest extends FormRequest public function getBudgetData(): array { return [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'active' => $this->boolean('active'), 'auto_budget_type' => $this->integer('auto_budget_type'), 'currency_id' => $this->integer('auto_budget_currency_id'), - 'auto_budget_amount' => $this->string('auto_budget_amount'), - 'auto_budget_period' => $this->string('auto_budget_period'), + 'auto_budget_amount' => $this->convertString('auto_budget_amount'), + 'auto_budget_period' => $this->convertString('auto_budget_period'), ]; } diff --git a/app/Http/Requests/CategoryFormRequest.php b/app/Http/Requests/CategoryFormRequest.php index 0d1c15b5a7..9ce60cbb11 100644 --- a/app/Http/Requests/CategoryFormRequest.php +++ b/app/Http/Requests/CategoryFormRequest.php @@ -42,7 +42,7 @@ class CategoryFormRequest extends FormRequest public function getCategoryData(): array { return [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'notes' => $this->stringWithNewlines('notes'), ]; } diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.php index ce85fe0f43..f391130bff 100644 --- a/app/Http/Requests/CurrencyFormRequest.php +++ b/app/Http/Requests/CurrencyFormRequest.php @@ -42,9 +42,9 @@ class CurrencyFormRequest extends FormRequest public function getCurrencyData(): array { return [ - 'name' => $this->string('name'), - 'code' => $this->string('code'), - 'symbol' => $this->string('symbol'), + 'name' => $this->convertString('name'), + 'code' => $this->convertString('code'), + 'symbol' => $this->convertString('symbol'), 'decimal_places' => $this->integer('decimal_places'), 'enabled' => $this->boolean('enabled'), ]; diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.php index fd7370e2ba..0b3c214983 100644 --- a/app/Http/Requests/JournalLinkRequest.php +++ b/app/Http/Requests/JournalLinkRequest.php @@ -46,7 +46,7 @@ class JournalLinkRequest extends FormRequest $parts = explode('_', $linkType); $return['link_type_id'] = (int) $parts[0]; $return['transaction_journal_id'] = $this->integer('opposing'); - $return['notes'] = $this->string('notes'); + $return['notes'] = $this->convertString('notes'); $return['direction'] = $parts[1]; return $return; diff --git a/app/Http/Requests/ObjectGroupFormRequest.php b/app/Http/Requests/ObjectGroupFormRequest.php index cda7aa70b2..bff7cebb8d 100644 --- a/app/Http/Requests/ObjectGroupFormRequest.php +++ b/app/Http/Requests/ObjectGroupFormRequest.php @@ -42,7 +42,7 @@ class ObjectGroupFormRequest extends FormRequest public function getObjectGroupData(): array { return [ - 'title' => $this->string('title'), + 'title' => $this->convertString('title'), ]; } diff --git a/app/Http/Requests/PiggyBankStoreRequest.php b/app/Http/Requests/PiggyBankStoreRequest.php index 9e5a62b96f..b4ae621013 100644 --- a/app/Http/Requests/PiggyBankStoreRequest.php +++ b/app/Http/Requests/PiggyBankStoreRequest.php @@ -41,13 +41,13 @@ class PiggyBankStoreRequest extends FormRequest public function getPiggyBankData(): array { return [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'startdate' => $this->getCarbonDate('startdate'), 'account_id' => $this->integer('account_id'), - 'targetamount' => $this->string('targetamount'), + 'targetamount' => $this->convertString('targetamount'), 'targetdate' => $this->getCarbonDate('targetdate'), 'notes' => $this->stringWithNewlines('notes'), - 'object_group_title' => $this->string('object_group'), + 'object_group_title' => $this->convertString('object_group'), ]; } diff --git a/app/Http/Requests/PiggyBankUpdateRequest.php b/app/Http/Requests/PiggyBankUpdateRequest.php index c15dfa9ca9..8249894e6b 100644 --- a/app/Http/Requests/PiggyBankUpdateRequest.php +++ b/app/Http/Requests/PiggyBankUpdateRequest.php @@ -42,13 +42,13 @@ class PiggyBankUpdateRequest extends FormRequest public function getPiggyBankData(): array { return [ - 'name' => $this->string('name'), + 'name' => $this->convertString('name'), 'startdate' => $this->getCarbonDate('startdate'), 'account_id' => $this->integer('account_id'), - 'targetamount' => $this->string('targetamount'), + 'targetamount' => $this->convertString('targetamount'), 'targetdate' => $this->getCarbonDate('targetdate'), 'notes' => $this->stringWithNewlines('notes'), - 'object_group_title' => $this->string('object_group'), + 'object_group_title' => $this->convertString('object_group'), ]; } diff --git a/app/Http/Requests/ReconciliationStoreRequest.php b/app/Http/Requests/ReconciliationStoreRequest.php index 8fc3ad046c..9331c81469 100644 --- a/app/Http/Requests/ReconciliationStoreRequest.php +++ b/app/Http/Requests/ReconciliationStoreRequest.php @@ -50,11 +50,11 @@ class ReconciliationStoreRequest extends FormRequest $data = [ 'start' => $this->getCarbonDate('start'), 'end' => $this->getCarbonDate('end'), - 'start_balance' => $this->string('startBalance'), - 'end_balance' => $this->string('endBalance'), - 'difference' => $this->string('difference'), + 'start_balance' => $this->convertString('startBalance'), + 'end_balance' => $this->convertString('endBalance'), + 'difference' => $this->convertString('difference'), 'journals' => $transactions, - 'reconcile' => $this->string('reconcile'), + 'reconcile' => $this->convertString('reconcile'), ]; Log::debug('In ReconciliationStoreRequest::getAll(). Will now return data.'); diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php index 9d481118f6..a5c400c88b 100644 --- a/app/Http/Requests/RecurrenceFormRequest.php +++ b/app/Http/Requests/RecurrenceFormRequest.php @@ -56,23 +56,23 @@ class RecurrenceFormRequest extends FormRequest $repetitionData = $this->parseRepetitionData(); $return = [ 'recurrence' => [ - 'type' => $this->string('transaction_type'), - 'title' => $this->string('title'), - 'description' => $this->string('recurring_description'), + 'type' => $this->convertString('transaction_type'), + 'title' => $this->convertString('title'), + 'description' => $this->convertString('recurring_description'), 'first_date' => $this->getCarbonDate('first_date'), 'repeat_until' => $this->getCarbonDate('repeat_until'), 'nr_of_repetitions' => $this->integer('repetitions'), 'apply_rules' => $this->boolean('apply_rules'), 'active' => $this->boolean('active'), - 'repetition_end' => $this->string('repetition_end'), + 'repetition_end' => $this->convertString('repetition_end'), ], 'transactions' => [ [ 'currency_id' => $this->integer('transaction_currency_id'), 'currency_code' => null, - 'type' => $this->string('transaction_type'), - 'description' => $this->string('transaction_description'), - 'amount' => $this->string('amount'), + 'type' => $this->convertString('transaction_type'), + 'description' => $this->convertString('transaction_description'), + 'amount' => $this->convertString('amount'), 'foreign_amount' => null, 'foreign_currency_id' => null, 'foreign_currency_code' => null, @@ -81,8 +81,8 @@ class RecurrenceFormRequest extends FormRequest 'bill_id' => $this->integer('bill_id'), 'bill_name' => null, 'category_id' => null, - 'category_name' => $this->string('category'), - 'tags' => '' !== $this->string('tags') ? explode(',', $this->string('tags')) : [], + 'category_name' => $this->convertString('category'), + 'tags' => '' !== $this->convertString('tags') ? explode(',', $this->convertString('tags')) : [], 'piggy_bank_id' => $this->integer('piggy_bank_id'), 'piggy_bank_name' => null, ], @@ -100,7 +100,7 @@ class RecurrenceFormRequest extends FormRequest // fill in foreign currency data if (null !== $this->float('foreign_amount')) { - $return['transactions'][0]['foreign_amount'] = $this->string('foreign_amount'); + $return['transactions'][0]['foreign_amount'] = $this->convertString('foreign_amount'); $return['transactions'][0]['foreign_currency_id'] = $this->integer('foreign_currency_id'); } // default values: @@ -109,9 +109,9 @@ class RecurrenceFormRequest extends FormRequest $return['transactions'][0]['destination_id'] = null; $return['transactions'][0]['destination_name'] = null; // fill in source and destination account data - switch ($this->string('transaction_type')) { + switch ($this->convertString('transaction_type')) { default: - throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); + throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type'))); case 'withdrawal': $return['transactions'][0]['source_id'] = $this->integer('source_id'); $return['transactions'][0]['destination_id'] = $this->integer('withdrawal_destination_id'); @@ -149,7 +149,7 @@ class RecurrenceFormRequest extends FormRequest */ private function parseRepetitionData(): array { - $value = $this->string('repetition_type'); + $value = $this->convertString('repetition_type'); $return = [ 'type' => '', 'moment' => '', @@ -224,7 +224,7 @@ class RecurrenceFormRequest extends FormRequest } // if ends after X repetitions, set another rule - if ('times' === $this->string('repetition_end')) { + if ('times' === $this->convertString('repetition_end')) { $rules['repetitions'] = 'required|numeric|between:0,254'; } // if foreign amount, currency must be different. @@ -233,12 +233,12 @@ class RecurrenceFormRequest extends FormRequest } // if ends at date X, set another rule. - if ('until_date' === $this->string('repetition_end')) { + if ('until_date' === $this->convertString('repetition_end')) { $rules['repeat_until'] = 'required|date|after:' . $tomorrow->format('Y-m-d'); } // switchc on type to expand rules for source and destination accounts: - switch ($this->string('transaction_type')) { + switch ($this->convertString('transaction_type')) { case strtolower(TransactionType::WITHDRAWAL): $rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts'; $rules['destination_name'] = 'between:1,255|nullable'; @@ -254,7 +254,7 @@ class RecurrenceFormRequest extends FormRequest break; default: - throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->string('transaction_type'))); + throw new FireflyException(sprintf('Cannot handle transaction type of type "%s"', $this->convertString('transaction_type'))); } // update some rules in case the user is editing a post: @@ -309,9 +309,9 @@ class RecurrenceFormRequest extends FormRequest // See reference nr. 45 - switch ($this->string('transaction_type')) { + switch ($this->convertString('transaction_type')) { default: - throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); + throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type'))); case 'withdrawal': $sourceId = (int) $data['source_id']; $destinationId = (int) $data['withdrawal_destination_id']; diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.php index 640f9ddb8b..0fdd1687dd 100644 --- a/app/Http/Requests/RuleFormRequest.php +++ b/app/Http/Requests/RuleFormRequest.php @@ -44,10 +44,10 @@ class RuleFormRequest extends FormRequest public function getRuleData(): array { return [ - 'title' => $this->string('title'), + 'title' => $this->convertString('title'), 'rule_group_id' => $this->integer('rule_group_id'), 'active' => $this->boolean('active'), - 'trigger' => $this->string('trigger'), + 'trigger' => $this->convertString('trigger'), 'description' => $this->stringWithNewlines('description'), 'stop_processing' => $this->boolean('stop_processing'), 'strict' => $this->boolean('strict'), diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.php index 8645e04651..5cb9b2c9be 100644 --- a/app/Http/Requests/RuleGroupFormRequest.php +++ b/app/Http/Requests/RuleGroupFormRequest.php @@ -48,7 +48,7 @@ class RuleGroupFormRequest extends FormRequest } return [ - 'title' => $this->string('title'), + 'title' => $this->convertString('title'), 'description' => $this->stringWithNewlines('description'), 'active' => $active, ]; diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php index e2b17ade5f..61255d00ed 100644 --- a/app/Http/Requests/TagFormRequest.php +++ b/app/Http/Requests/TagFormRequest.php @@ -44,9 +44,9 @@ class TagFormRequest extends FormRequest public function collectTagData(): array { $data = [ - 'tag' => $this->string('tag'), + 'tag' => $this->convertString('tag'), 'date' => $this->getCarbonDate('date'), - 'description' => $this->string('description'), + 'description' => $this->convertString('description'), ]; return $this->appendLocationData($data, 'location'); diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php index 86dd8900ac..816dd754fa 100644 --- a/app/Http/Requests/UserFormRequest.php +++ b/app/Http/Requests/UserFormRequest.php @@ -43,10 +43,10 @@ class UserFormRequest extends FormRequest public function getUserData(): array { return [ - 'email' => $this->string('email'), + 'email' => $this->convertString('email'), 'blocked' => 1 === $this->integer('blocked'), - 'blocked_code' => $this->string('blocked_code'), - 'password' => $this->string('password'), + 'blocked_code' => $this->convertString('blocked_code'), + 'password' => $this->convertString('password'), 'is_owner' => 1 === $this->integer('is_owner'), ]; } diff --git a/app/Support/Request/AppendsLocationData.php b/app/Support/Request/AppendsLocationData.php index 77b7e7e3e1..7958cacdac 100644 --- a/app/Support/Request/AppendsLocationData.php +++ b/app/Support/Request/AppendsLocationData.php @@ -69,18 +69,18 @@ trait AppendsLocationData if ($isValidPOST) { Log::debug('Method is POST and all fields present and not NULL.'); $data['store_location'] = true; - $data['longitude'] = $this->string($longitudeKey); - $data['latitude'] = $this->string($latitudeKey); - $data['zoom_level'] = $this->string($zoomLevelKey); + $data['longitude'] = $this->convertString($longitudeKey); + $data['latitude'] = $this->convertString($latitudeKey); + $data['zoom_level'] = $this->convertString($zoomLevelKey); } // for a PUT (api update) or POST update (UI) if ($isValidPUT) { Log::debug('Method is PUT and all fields present and not NULL.'); $data['update_location'] = true; - $data['longitude'] = $this->string($longitudeKey); - $data['latitude'] = $this->string($latitudeKey); - $data['zoom_level'] = $this->string($zoomLevelKey); + $data['longitude'] = $this->convertString($longitudeKey); + $data['latitude'] = $this->convertString($latitudeKey); + $data['zoom_level'] = $this->convertString($zoomLevelKey); } if ($isValidEmptyPUT) { Log::debug('Method is PUT and all fields present and NULL.'); diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index 695978ee86..8cd445b9f5 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -51,7 +51,7 @@ trait ConvertsDataTypes * * @return string */ - public function string(string $field): string + public function convertString(string $field): string { return $this->clearString((string) ($this->get($field) ?? ''), false); }