From d2c1e3097906a4a7e9c7624d1e2ddb2c7ea5a065 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Sep 2018 07:48:17 +0200 Subject: [PATCH] Fixes for #1670 --- app/Api/V1/Requests/PiggyBankRequest.php | 7 +++++-- resources/lang/en_US/validation.php | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Api/V1/Requests/PiggyBankRequest.php b/app/Api/V1/Requests/PiggyBankRequest.php index 68ef285527..30bf4e8dfe 100644 --- a/app/Api/V1/Requests/PiggyBankRequest.php +++ b/app/Api/V1/Requests/PiggyBankRequest.php @@ -50,14 +50,17 @@ class PiggyBankRequest extends Request */ public function getAll(): array { + $current = $this->string('current_amount'); + $current = '' === $current ? '0' : $current; + return [ 'name' => $this->string('name'), 'account_id' => $this->integer('account_id'), 'targetamount' => $this->string('target_amount'), - 'current_amount' => $this->string('current_amount'), + 'current_amount' => $current, 'start_date' => $this->date('start_date'), 'target_date' => $this->date('target_date'), - 'notes' => $this->string('notes'), + 'notes' => $this->string('notes'), ]; } diff --git a/resources/lang/en_US/validation.php b/resources/lang/en_US/validation.php index ad42c3d7ae..39f4f3f50c 100644 --- a/resources/lang/en_US/validation.php +++ b/resources/lang/en_US/validation.php @@ -87,6 +87,7 @@ return [ 'max.array' => 'The :attribute may not have more than :max items.', 'mimes' => 'The :attribute must be a file of type: :values.', 'min.numeric' => 'The :attribute must be at least :min.', + 'lte.numeric' => 'The :attribute must be less than or equal :value.', 'min.file' => 'The :attribute must be at least :min kilobytes.', 'min.string' => 'The :attribute must be at least :min characters.', 'min.array' => 'The :attribute must have at least :min items.',