Code for optional fields #301

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole
2016-09-09 11:19:40 +02:00
parent 8d19f60091
commit 176752e219
7 changed files with 212 additions and 54 deletions

View File

@@ -60,6 +60,13 @@ class JournalFormRequest extends Request
'category' => $this->get('category') ?? '',
'tags' => explode(',', $tags),
'piggy_bank_id' => $this->get('piggy_bank_id') ? intval($this->get('piggy_bank_id')) : 0,
// new custom fields here:
'due_date' => $this->get('due_date') ? new Carbon($this->get('due_date')) : null,
'payment_date' => $this->get('payment_date') ? new Carbon($this->get('payment_date')) : null,
'internal_reference' => $this->get('internal_reference'),
'notes' => $this->get('notes'),
];
}
@@ -81,6 +88,12 @@ class JournalFormRequest extends Request
'category' => 'between:1,255',
'amount_currency_id_amount' => 'required|exists:transaction_currencies,id',
'piggy_bank_id' => 'numeric',
// new custom fields here:
'due_date' => 'date',
'payment_date' => 'date',
'internal_reference' => 'min:1,max:255',
'notes' => 'min:1,max:65536',
];
switch ($what) {