Catch amounts.

This commit is contained in:
James Cole 2023-12-31 17:29:00 +01:00
parent 51ca8277bb
commit e318e8e9cf
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
4 changed files with 8 additions and 8 deletions

View File

@ -64,11 +64,11 @@ class StoreRequest extends FormRequest
{
return [
'name' => 'required|between:1,255|uniquePiggyBankForUser',
'current_amount' => ['numeric', 'gte:0', 'lte:target_amount'],
'current_amount' => ['numeric', 'gte:0', 'lte:target_amount','max:1000000000'],
'account_id' => 'required|numeric|belongsToUser:accounts,id',
'object_group_id' => 'numeric|belongsToUser:object_groups,id',
'object_group_title' => 'between:1,255',
'target_amount' => ['numeric', 'gte:0', 'lte:target_amount', 'required'],
'target_amount' => ['numeric', 'gte:0', 'lte:target_amount', 'required','max:1000000000'],
'start_date' => 'date|nullable',
'target_date' => 'date|nullable|after:start_date',
'notes' => 'max:65000',

View File

@ -69,8 +69,8 @@ class UpdateRequest extends FormRequest
return [
'name' => 'between:1,255|uniquePiggyBankForUser:'.$piggyBank->id,
'current_amount' => ['numeric', 'gte:0', new LessThanPiggyTarget()],
'target_amount' => 'numeric|gte:0',
'current_amount' => ['numeric', 'gte:0', new LessThanPiggyTarget(),'max:1000000000'],
'target_amount' => 'numeric|gte:0|max:1000000000',
'start_date' => 'date|nullable',
'target_date' => 'date|nullable|after:start_date',
'notes' => 'max:65000',

View File

@ -92,8 +92,8 @@ class StoreRequest extends FormRequest
'repetitions.*.weekend' => 'numeric|min:1|max:4',
'transactions.*.description' => 'required|between:1,255',
'transactions.*.amount' => 'required|numeric|gt:0',
'transactions.*.foreign_amount' => 'nullable|numeric|gt:0',
'transactions.*.amount' => 'required|numeric|gt:0|max:1000000000',
'transactions.*.foreign_amount' => 'nullable|numeric|gt:0|max:1000000000',
'transactions.*.currency_id' => 'nullable|numeric|exists:transaction_currencies,id',
'transactions.*.currency_code' => 'nullable|min:3|max:51|exists:transaction_currencies,code',
'transactions.*.foreign_currency_id' => 'nullable|numeric|exists:transaction_currencies,id',

View File

@ -99,8 +99,8 @@ class UpdateRequest extends FormRequest
'repetitions.*.weekend' => 'nullable|numeric|min:1|max:4',
'transactions.*.description' => 'between:1,255',
'transactions.*.amount' => 'numeric|gt:0',
'transactions.*.foreign_amount' => 'nullable|numeric|gt:0',
'transactions.*.amount' => 'numeric|gt:0|max:1000000000',
'transactions.*.foreign_amount' => 'nullable|numeric|gt:0|max:1000000000',
'transactions.*.currency_id' => 'nullable|numeric|exists:transaction_currencies,id',
'transactions.*.currency_code' => 'nullable|min:3|max:51|exists:transaction_currencies,code',
'transactions.*.foreign_currency_id' => 'nullable|numeric|exists:transaction_currencies,id',