mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-08-18 17:04:56 -05:00
Autoformat lol
This commit is contained in:
@@ -23,12 +23,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -47,13 +47,13 @@ class BudgetFormUpdateRequest extends FormRequest
|
||||
public function getBudgetData(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->convertString('name'),
|
||||
'active' => $this->boolean('active'),
|
||||
'auto_budget_type' => $this->convertInteger('auto_budget_type'),
|
||||
'currency_id' => $this->convertInteger('auto_budget_currency_id'),
|
||||
'auto_budget_amount' => $this->convertString('auto_budget_amount'),
|
||||
'auto_budget_period' => $this->convertString('auto_budget_period'),
|
||||
'notes' => $this->stringWithNewlines('notes'),
|
||||
'name' => $this->convertString('name'),
|
||||
'active' => $this->boolean('active'),
|
||||
'auto_budget_type' => $this->convertInteger('auto_budget_type'),
|
||||
'currency_id' => $this->convertInteger('auto_budget_currency_id'),
|
||||
'auto_budget_amount' => $this->convertString('auto_budget_amount'),
|
||||
'auto_budget_period' => $this->convertString('auto_budget_period'),
|
||||
'notes' => $this->stringWithNewlines('notes')
|
||||
];
|
||||
}
|
||||
|
||||
@@ -65,10 +65,10 @@ class BudgetFormUpdateRequest extends FormRequest
|
||||
$nameRule = 'required|min:1|max:255|uniqueObjectForUser:budgets,name';
|
||||
|
||||
/** @var null|Budget $budget */
|
||||
$budget = $this->route()->parameter('budget');
|
||||
$budget = $this->route()->parameter('budget');
|
||||
|
||||
if (null !== $budget) {
|
||||
$nameRule = 'required|min:1|max:255|uniqueObjectForUser:budgets,name,'.$budget->id;
|
||||
$nameRule = 'required|min:1|max:255|uniqueObjectForUser:budgets,name,' . $budget->id;
|
||||
}
|
||||
|
||||
return [
|
||||
@@ -78,7 +78,7 @@ class BudgetFormUpdateRequest extends FormRequest
|
||||
'auto_budget_currency_id' => 'exists:transaction_currencies,id',
|
||||
'auto_budget_amount' => ['required_if:auto_budget_type,1', 'required_if:auto_budget_type,2|numeric', new IsValidPositiveAmount()],
|
||||
'auto_budget_period' => 'in:daily,weekly,monthly,quarterly,half_year,yearly',
|
||||
'notes' => 'min:1|max:32768|nullable',
|
||||
'notes' => 'min:1|max:32768|nullable'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -87,12 +87,10 @@ class BudgetFormUpdateRequest extends FormRequest
|
||||
*/
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator): void {
|
||||
// validate all account info
|
||||
$this->validateAutoBudgetAmount($validator);
|
||||
}
|
||||
);
|
||||
$validator->after(function (Validator $validator): void {
|
||||
// validate all account info
|
||||
$this->validateAutoBudgetAmount($validator);
|
||||
});
|
||||
if ($validator->fails()) {
|
||||
Log::channel('audit')->error(sprintf('Validation errors in %s', self::class), $validator->errors()->toArray());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user