Move stuff to request classes for #339

This commit is contained in:
James Cole
2016-10-23 12:10:22 +02:00
parent 83f48418f6
commit 9a30fbd05a
15 changed files with 129 additions and 91 deletions

View File

@@ -13,6 +13,7 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
use Carbon\Carbon;
use Input;
/**
@@ -32,6 +33,21 @@ class PiggyBankFormRequest extends Request
return auth()->check();
}
/**
* @return array
*/
public function getPiggyBankData(): array
{
return [
'name' => trim($this->get('name')),
'startdate' => new Carbon,
'account_id' => intval($this->get('account_id')),
'targetamount' => round($this->get('targetamount'), 2),
'targetdate' => strlen($this->get('targetdate')) > 0 ? new Carbon($this->get('targetdate')) : null,
'note' => trim($this->get('note')),
];
}
/**
* @return array
*/