Cleaned up some double code.

This commit is contained in:
James Cole
2015-03-29 11:51:26 +02:00
parent 24dd3578ed
commit bcf066ead7
5 changed files with 111 additions and 130 deletions

View File

@@ -3,8 +3,10 @@
namespace FireflyIII\Http\Requests;
use Auth;
use Input;
use Carbon\Carbon;
use Exception;
use Input;
/**
* Class JournalFormRequest
*
@@ -21,6 +23,28 @@ class JournalFormRequest extends Request
return Auth::check();
}
/**
* @return array
*/
public function getJournalData()
{
return [
'what' => $this->get('what'),
'description' => $this->get('description'),
'account_id' => intval($this->get('account_id')),
'account_from_id' => intval($this->get('account_from_id')),
'account_to_id' => intval($this->get('account_to_id')),
'expense_account' => $this->get('expense_account'),
'revenue_account' => $this->get('revenue_account'),
'amount' => floatval($this->get('amount')),
'user' => Auth::user()->id,
'amount_currency_id' => intval($this->get('amount_currency_id')),
'date' => new Carbon($this->get('date')),
'budget_id' => intval($this->get('budget_id')),
'category' => $this->get('category'),
];
}
/**
* @return array
* @throws Exception