2018-06-16 14:47:51 -05:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* RecurrenceFormRequest.php
|
2020-01-31 00:32:04 -06:00
|
|
|
* Copyright (c) 2019 james@firefly-iii.org
|
2018-06-16 14:47:51 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2018-06-16 14:47:51 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
2018-06-16 14:47:51 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2018-06-16 14:47:51 -05:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-01 23:37:26 -05:00
|
|
|
* GNU Affero General Public License for more details.
|
2018-06-16 14:47:51 -05:00
|
|
|
*
|
2019-10-01 23:37:26 -05:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2018-06-16 14:47:51 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace FireflyIII\Http\Requests;
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use FireflyIII\Exceptions\FireflyException;
|
2021-03-15 02:51:21 -05:00
|
|
|
use FireflyIII\Factory\CategoryFactory;
|
2018-06-21 11:57:51 -05:00
|
|
|
use FireflyIII\Models\Recurrence;
|
2018-06-16 14:47:51 -05:00
|
|
|
use FireflyIII\Models\TransactionType;
|
|
|
|
use FireflyIII\Rules\ValidRecurrenceRepetitionType;
|
2018-06-17 08:14:34 -05:00
|
|
|
use FireflyIII\Rules\ValidRecurrenceRepetitionValue;
|
2020-10-24 00:55:09 -05:00
|
|
|
use FireflyIII\Support\Request\ChecksLogin;
|
2020-07-18 01:42:13 -05:00
|
|
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
2019-07-01 13:22:35 -05:00
|
|
|
use FireflyIII\Validation\AccountValidator;
|
2020-10-24 00:55:09 -05:00
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
2019-07-01 13:22:35 -05:00
|
|
|
use Illuminate\Validation\Validator;
|
|
|
|
use Log;
|
2018-06-16 14:47:51 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class RecurrenceFormRequest
|
|
|
|
*/
|
2020-10-24 00:55:09 -05:00
|
|
|
class RecurrenceFormRequest extends FormRequest
|
2018-06-16 14:47:51 -05:00
|
|
|
{
|
2022-10-30 08:24:28 -05:00
|
|
|
use ConvertsDataTypes;
|
|
|
|
use ChecksLogin;
|
2018-06-16 14:47:51 -05:00
|
|
|
|
|
|
|
/**
|
2018-07-22 01:10:16 -05:00
|
|
|
* Get the data required by the controller.
|
|
|
|
*
|
2020-10-24 00:55:09 -05:00
|
|
|
* @return array
|
2018-06-16 14:47:51 -05:00
|
|
|
* @throws FireflyException
|
2018-07-20 07:34:56 -05:00
|
|
|
*
|
2018-06-16 14:47:51 -05:00
|
|
|
*/
|
|
|
|
public function getAll(): array
|
|
|
|
{
|
2018-06-17 08:14:34 -05:00
|
|
|
$repetitionData = $this->parseRepetitionData();
|
|
|
|
$return = [
|
2018-06-16 14:47:51 -05:00
|
|
|
'recurrence' => [
|
2022-05-02 12:35:35 -05:00
|
|
|
'type' => $this->convertString('transaction_type'),
|
|
|
|
'title' => $this->convertString('title'),
|
|
|
|
'description' => $this->convertString('recurring_description'),
|
2021-12-28 13:42:50 -06:00
|
|
|
'first_date' => $this->getCarbonDate('first_date'),
|
|
|
|
'repeat_until' => $this->getCarbonDate('repeat_until'),
|
2022-09-30 13:07:01 -05:00
|
|
|
'nr_of_repetitions' => $this->convertInteger('repetitions'),
|
2021-04-04 05:48:44 -05:00
|
|
|
'apply_rules' => $this->boolean('apply_rules'),
|
|
|
|
'active' => $this->boolean('active'),
|
2022-05-02 12:35:35 -05:00
|
|
|
'repetition_end' => $this->convertString('repetition_end'),
|
2018-06-16 14:47:51 -05:00
|
|
|
],
|
|
|
|
'transactions' => [
|
|
|
|
[
|
2022-09-30 13:07:01 -05:00
|
|
|
'currency_id' => $this->convertInteger('transaction_currency_id'),
|
2018-06-29 23:14:39 -05:00
|
|
|
'currency_code' => null,
|
2022-05-02 12:35:35 -05:00
|
|
|
'type' => $this->convertString('transaction_type'),
|
|
|
|
'description' => $this->convertString('transaction_description'),
|
|
|
|
'amount' => $this->convertString('amount'),
|
2018-06-29 23:14:39 -05:00
|
|
|
'foreign_amount' => null,
|
|
|
|
'foreign_currency_id' => null,
|
|
|
|
'foreign_currency_code' => null,
|
2022-09-30 13:07:01 -05:00
|
|
|
'budget_id' => $this->convertInteger('budget_id'),
|
2018-06-29 23:14:39 -05:00
|
|
|
'budget_name' => null,
|
2022-09-30 13:07:01 -05:00
|
|
|
'bill_id' => $this->convertInteger('bill_id'),
|
2021-07-18 07:51:30 -05:00
|
|
|
'bill_name' => null,
|
2018-06-29 23:14:39 -05:00
|
|
|
'category_id' => null,
|
2022-05-02 12:35:35 -05:00
|
|
|
'category_name' => $this->convertString('category'),
|
|
|
|
'tags' => '' !== $this->convertString('tags') ? explode(',', $this->convertString('tags')) : [],
|
2022-09-30 13:07:01 -05:00
|
|
|
'piggy_bank_id' => $this->convertInteger('piggy_bank_id'),
|
2019-08-26 23:36:16 -05:00
|
|
|
'piggy_bank_name' => null,
|
2018-06-16 14:47:51 -05:00
|
|
|
],
|
|
|
|
],
|
|
|
|
'repetitions' => [
|
|
|
|
[
|
2018-06-26 22:37:56 -05:00
|
|
|
'type' => $repetitionData['type'],
|
|
|
|
'moment' => $repetitionData['moment'],
|
2022-09-30 13:07:01 -05:00
|
|
|
'skip' => $this->convertInteger('skip'),
|
|
|
|
'weekend' => $this->convertInteger('weekend'),
|
2018-06-16 14:47:51 -05:00
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
// fill in foreign currency data
|
2022-12-27 14:13:18 -06:00
|
|
|
if (null !== $this->convertFloat('foreign_amount')) { // intentional float, used because it defaults to null.
|
2022-05-02 12:35:35 -05:00
|
|
|
$return['transactions'][0]['foreign_amount'] = $this->convertString('foreign_amount');
|
2022-09-30 13:07:01 -05:00
|
|
|
$return['transactions'][0]['foreign_currency_id'] = $this->convertInteger('foreign_currency_id');
|
2018-06-16 14:47:51 -05:00
|
|
|
}
|
2018-06-29 23:14:39 -05:00
|
|
|
// default values:
|
|
|
|
$return['transactions'][0]['source_id'] = null;
|
|
|
|
$return['transactions'][0]['source_name'] = null;
|
|
|
|
$return['transactions'][0]['destination_id'] = null;
|
|
|
|
$return['transactions'][0]['destination_name'] = null;
|
2022-12-30 02:28:03 -06:00
|
|
|
$throwError = true;
|
|
|
|
$type = $this->convertString('transaction_type');
|
|
|
|
if ('withdrawal' === $type) {
|
|
|
|
$throwError = false;
|
|
|
|
$return['transactions'][0]['source_id'] = $this->convertInteger('source_id');
|
|
|
|
$return['transactions'][0]['destination_id'] = $this->convertInteger('withdrawal_destination_id');
|
|
|
|
}
|
|
|
|
if ('deposit' === $type) {
|
|
|
|
$throwError = false;
|
|
|
|
$return['transactions'][0]['source_id'] = $this->convertInteger('deposit_source_id');
|
|
|
|
$return['transactions'][0]['destination_id'] = $this->convertInteger('destination_id');
|
|
|
|
}
|
|
|
|
if ('transfer' === $type) {
|
|
|
|
$throwError = false;
|
|
|
|
$return['transactions'][0]['source_id'] = $this->convertInteger('source_id');
|
|
|
|
$return['transactions'][0]['destination_id'] = $this->convertInteger('destination_id');
|
|
|
|
}
|
|
|
|
if (true === $throwError) {
|
|
|
|
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
2018-06-16 14:47:51 -05:00
|
|
|
}
|
|
|
|
|
2021-03-15 02:51:21 -05:00
|
|
|
// replace category name with a new category:
|
|
|
|
$factory = app(CategoryFactory::class);
|
|
|
|
$factory->setUser(auth()->user());
|
2022-12-30 02:28:03 -06:00
|
|
|
/**
|
|
|
|
* @var int $index
|
|
|
|
* @var array $transaction
|
|
|
|
*/
|
2021-03-21 03:15:40 -05:00
|
|
|
foreach ($return['transactions'] as $index => $transaction) {
|
|
|
|
$categoryName = $transaction['category_name'] ?? null;
|
|
|
|
if (null !== $categoryName) {
|
2021-03-15 02:51:21 -05:00
|
|
|
$category = $factory->findOrCreate(null, $categoryName);
|
2021-03-21 03:15:40 -05:00
|
|
|
if (null !== $category) {
|
2021-03-15 02:51:21 -05:00
|
|
|
$return['transactions'][$index]['category_id'] = $category->id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-16 14:47:51 -05:00
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
2020-10-24 00:55:09 -05:00
|
|
|
/**
|
|
|
|
* Parses repetition data.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
private function parseRepetitionData(): array
|
|
|
|
{
|
2022-05-02 12:35:35 -05:00
|
|
|
$value = $this->convertString('repetition_type');
|
2020-10-24 00:55:09 -05:00
|
|
|
$return = [
|
|
|
|
'type' => '',
|
|
|
|
'moment' => '',
|
|
|
|
];
|
|
|
|
|
|
|
|
if ('daily' === $value) {
|
|
|
|
$return['type'] = $value;
|
|
|
|
}
|
|
|
|
//monthly,17
|
|
|
|
//ndom,3,7
|
2022-10-30 08:24:28 -05:00
|
|
|
if (in_array(substr($value, 0, 6), ['yearly', 'weekly'], true)) {
|
2020-10-24 00:55:09 -05:00
|
|
|
$return['type'] = substr($value, 0, 6);
|
|
|
|
$return['moment'] = substr($value, 7);
|
|
|
|
}
|
2021-07-18 07:51:30 -05:00
|
|
|
if (str_starts_with($value, 'monthly')) {
|
2020-10-24 00:55:09 -05:00
|
|
|
$return['type'] = substr($value, 0, 7);
|
|
|
|
$return['moment'] = substr($value, 8);
|
|
|
|
}
|
2021-07-18 07:51:30 -05:00
|
|
|
if (str_starts_with($value, 'ndom')) {
|
2020-10-24 00:55:09 -05:00
|
|
|
$return['type'] = substr($value, 0, 4);
|
|
|
|
$return['moment'] = substr($value, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
2018-06-16 14:47:51 -05:00
|
|
|
/**
|
2018-07-22 01:10:16 -05:00
|
|
|
* The rules for this request.
|
|
|
|
*
|
2020-10-24 00:55:09 -05:00
|
|
|
* @return array
|
2018-07-20 07:34:56 -05:00
|
|
|
*
|
2018-06-16 14:47:51 -05:00
|
|
|
*/
|
|
|
|
public function rules(): array
|
|
|
|
{
|
2020-09-11 00:12:33 -05:00
|
|
|
$today = today(config('app.timezone'));
|
2023-02-11 00:36:45 -06:00
|
|
|
$tomorrow = today(config('app.timezone'))->addDay();
|
2018-08-06 12:14:30 -05:00
|
|
|
$rules = [
|
2018-06-16 14:47:51 -05:00
|
|
|
// mandatory info for recurrence.
|
2018-06-29 22:21:21 -05:00
|
|
|
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
|
2022-12-29 12:42:26 -06:00
|
|
|
'first_date' => 'required|date|after:'.$today->format('Y-m-d'),
|
2022-10-30 08:24:28 -05:00
|
|
|
'repetition_type' => ['required', new ValidRecurrenceRepetitionValue(), new ValidRecurrenceRepetitionType(), 'between:1,20'],
|
2021-11-05 01:48:22 -05:00
|
|
|
'skip' => 'required|numeric|integer|gte:0|lte:31',
|
2018-06-16 14:47:51 -05:00
|
|
|
|
|
|
|
// optional for recurrence:
|
2018-06-29 22:21:21 -05:00
|
|
|
'recurring_description' => 'between:0,65000',
|
|
|
|
'active' => 'numeric|between:0,1',
|
|
|
|
'apply_rules' => 'numeric|between:0,1',
|
2018-06-16 14:47:51 -05:00
|
|
|
|
|
|
|
// mandatory for transaction:
|
2018-06-29 22:21:21 -05:00
|
|
|
'transaction_description' => 'required|between:1,255',
|
|
|
|
'transaction_type' => 'required|in:withdrawal,deposit,transfer',
|
|
|
|
'transaction_currency_id' => 'required|exists:transaction_currencies,id',
|
2020-07-05 23:55:27 -05:00
|
|
|
'amount' => 'numeric|required|gt:0|max:1000000000',
|
2018-06-16 14:47:51 -05:00
|
|
|
// mandatory account info:
|
2018-06-29 22:21:21 -05:00
|
|
|
'source_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
|
|
|
'source_name' => 'between:1,255|nullable',
|
|
|
|
'destination_id' => 'numeric|belongsToUser:accounts,id|nullable',
|
|
|
|
'destination_name' => 'between:1,255|nullable',
|
2018-06-16 14:47:51 -05:00
|
|
|
|
|
|
|
// foreign amount data:
|
2020-07-05 23:55:27 -05:00
|
|
|
'foreign_amount' => 'nullable|gt:0|max:1000000000',
|
2018-06-16 14:47:51 -05:00
|
|
|
|
|
|
|
// optional fields:
|
2018-06-29 22:21:21 -05:00
|
|
|
'budget_id' => 'mustExist:budgets,id|belongsToUser:budgets,id|nullable',
|
2021-07-18 07:51:30 -05:00
|
|
|
'bill_id' => 'mustExist:bills,id|belongsToUser:bills,id|nullable',
|
2018-06-29 22:21:21 -05:00
|
|
|
'category' => 'between:1,255|nullable',
|
|
|
|
'tags' => 'between:1,255|nullable',
|
2018-06-16 14:47:51 -05:00
|
|
|
];
|
2022-09-30 13:07:01 -05:00
|
|
|
if ($this->convertInteger('foreign_currency_id') > 0) {
|
2018-06-18 14:07:09 -05:00
|
|
|
$rules['foreign_currency_id'] = 'exists:transaction_currencies,id';
|
|
|
|
}
|
2018-06-16 14:47:51 -05:00
|
|
|
|
|
|
|
// if ends after X repetitions, set another rule
|
2022-05-02 12:35:35 -05:00
|
|
|
if ('times' === $this->convertString('repetition_end')) {
|
2018-06-16 14:47:51 -05:00
|
|
|
$rules['repetitions'] = 'required|numeric|between:0,254';
|
|
|
|
}
|
|
|
|
// if foreign amount, currency must be different.
|
2022-12-27 14:13:18 -06:00
|
|
|
if (null !== $this->convertFloat('foreign_amount')) { // intentional float, used because it defaults to null.
|
2018-06-16 14:47:51 -05:00
|
|
|
$rules['foreign_currency_id'] = 'exists:transaction_currencies,id|different:transaction_currency_id';
|
|
|
|
}
|
|
|
|
|
|
|
|
// if ends at date X, set another rule.
|
2022-05-02 12:35:35 -05:00
|
|
|
if ('until_date' === $this->convertString('repetition_end')) {
|
2022-12-29 12:42:26 -06:00
|
|
|
$rules['repeat_until'] = 'required|date|after:'.$tomorrow->format('Y-m-d');
|
2018-06-16 14:47:51 -05:00
|
|
|
}
|
|
|
|
|
2022-10-04 12:12:57 -05:00
|
|
|
// switch on type to expand rules for source and destination accounts:
|
2022-12-30 02:28:03 -06:00
|
|
|
$type = strtolower($this->convertString('transaction_type'));
|
|
|
|
if (strtolower(TransactionType::WITHDRAWAL) === $type) {
|
|
|
|
$rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
|
|
|
$rules['destination_name'] = 'between:1,255|nullable';
|
|
|
|
}
|
|
|
|
if (strtolower(TransactionType::DEPOSIT) === $type) {
|
|
|
|
$rules['source_name'] = 'between:1,255|nullable';
|
|
|
|
$rules['destination_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
|
|
|
|
}
|
|
|
|
if (strtolower(TransactionType::TRANSFER) === $type) {
|
|
|
|
// this may not work:
|
|
|
|
$rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:destination_id';
|
|
|
|
$rules['destination_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:source_id';
|
2018-06-16 14:47:51 -05:00
|
|
|
}
|
|
|
|
|
2018-06-21 11:57:51 -05:00
|
|
|
// update some rules in case the user is editing a post:
|
|
|
|
/** @var Recurrence $recurrence */
|
|
|
|
$recurrence = $this->route()->parameter('recurrence');
|
|
|
|
if ($recurrence instanceof Recurrence) {
|
|
|
|
$rules['id'] = 'required|numeric|exists:recurrences,id';
|
2022-12-29 12:42:26 -06:00
|
|
|
$rules['title'] = 'required|between:1,255|uniqueObjectForUser:recurrences,title,'.$recurrence->id;
|
2018-06-21 11:57:51 -05:00
|
|
|
$rules['first_date'] = 'required|date';
|
|
|
|
}
|
2019-02-13 10:38:41 -06:00
|
|
|
|
2018-06-16 14:47:51 -05:00
|
|
|
return $rules;
|
|
|
|
}
|
2018-06-17 08:14:34 -05:00
|
|
|
|
2020-10-24 00:55:09 -05:00
|
|
|
/**
|
|
|
|
* Configure the validator instance with special rules for after the basic validation rules.
|
|
|
|
*
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param Validator $validator
|
2020-10-24 00:55:09 -05:00
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function withValidator(Validator $validator): void
|
|
|
|
{
|
|
|
|
$validator->after(
|
|
|
|
function (Validator $validator) {
|
|
|
|
// validate all account info
|
|
|
|
$this->validateAccountInformation($validator);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-08-26 23:36:16 -05:00
|
|
|
/**
|
|
|
|
* Validates the given account information. Switches on given transaction type.
|
|
|
|
*
|
2022-12-29 12:42:26 -06:00
|
|
|
* @param Validator $validator
|
2019-08-26 23:36:16 -05:00
|
|
|
*
|
|
|
|
* @throws FireflyException
|
|
|
|
*/
|
|
|
|
public function validateAccountInformation(Validator $validator): void
|
|
|
|
{
|
2021-12-18 05:35:17 -06:00
|
|
|
Log::debug('Now in validateAccountInformation (RecurrenceFormRequest)()');
|
2019-08-26 23:36:16 -05:00
|
|
|
/** @var AccountValidator $accountValidator */
|
|
|
|
$accountValidator = app(AccountValidator::class);
|
|
|
|
$data = $validator->getData();
|
|
|
|
$transactionType = $data['transaction_type'] ?? 'invalid';
|
|
|
|
|
|
|
|
$accountValidator->setTransactionType($transactionType);
|
|
|
|
|
|
|
|
// default values:
|
|
|
|
$sourceId = null;
|
|
|
|
$destinationId = null;
|
|
|
|
|
2022-10-30 05:43:17 -05:00
|
|
|
// TODO typeOverrule: the account validator may have another opinion the transaction type.
|
2022-12-30 02:28:03 -06:00
|
|
|
// TODO either use 'withdrawal' or the strtolower() variant, not both.
|
|
|
|
$type = $this->convertString('transaction_type');
|
|
|
|
$throwError = true;
|
2022-12-30 13:38:54 -06:00
|
|
|
if ('withdrawal' === $type) {
|
2022-12-30 02:28:03 -06:00
|
|
|
$throwError = false;
|
|
|
|
$sourceId = (int)$data['source_id'];
|
|
|
|
$destinationId = (int)$data['withdrawal_destination_id'];
|
|
|
|
}
|
2022-12-30 13:38:54 -06:00
|
|
|
if ('deposit' === $type) {
|
2022-12-30 02:28:03 -06:00
|
|
|
$throwError = false;
|
|
|
|
$sourceId = (int)$data['deposit_source_id'];
|
|
|
|
$destinationId = (int)$data['destination_id'];
|
|
|
|
}
|
2022-12-30 13:38:54 -06:00
|
|
|
if ('transfer' === $type) {
|
2022-12-30 02:28:03 -06:00
|
|
|
$throwError = false;
|
|
|
|
$sourceId = (int)$data['source_id'];
|
|
|
|
$destinationId = (int)$data['destination_id'];
|
2019-08-26 23:36:16 -05:00
|
|
|
}
|
2022-12-30 13:38:54 -06:00
|
|
|
if (true === $throwError) {
|
2022-12-30 02:28:03 -06:00
|
|
|
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->convertString('transaction_type')));
|
|
|
|
}
|
|
|
|
|
2019-08-26 23:36:16 -05:00
|
|
|
// validate source account.
|
2021-12-18 05:35:17 -06:00
|
|
|
$validSource = $accountValidator->validateSource(['id' => $sourceId,]);
|
2019-08-26 23:36:16 -05:00
|
|
|
|
|
|
|
// do something with result:
|
|
|
|
if (false === $validSource) {
|
2022-12-29 12:42:26 -06:00
|
|
|
$message = (string)trans('validation.generic_invalid_source');
|
2019-08-26 23:36:16 -05:00
|
|
|
$validator->errors()->add('source_id', $message);
|
|
|
|
$validator->errors()->add('deposit_source_id', $message);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// validate destination account
|
2021-12-18 05:35:17 -06:00
|
|
|
$validDestination = $accountValidator->validateDestination(['id' => $destinationId,]);
|
2019-08-26 23:36:16 -05:00
|
|
|
// do something with result:
|
|
|
|
if (false === $validDestination) {
|
2022-12-29 12:42:26 -06:00
|
|
|
$message = (string)trans('validation.generic_invalid_destination');
|
2019-08-26 23:36:16 -05:00
|
|
|
$validator->errors()->add('destination_id', $message);
|
|
|
|
$validator->errors()->add('withdrawal_destination_id', $message);
|
|
|
|
}
|
|
|
|
}
|
2018-07-22 13:32:02 -05:00
|
|
|
}
|