This commit is contained in:
James Cole 2015-12-26 08:12:44 +01:00
parent 170c1793cc
commit eadc630fcb

View File

@ -29,17 +29,18 @@ class BillFormRequest extends Request
public function getBillData() public function getBillData()
{ {
return [ return [
'name' => $this->get('name'), 'name' => $this->get('name'),
'match' => $this->get('match'), 'match' => $this->get('match'),
'amount_min' => round($this->get('amount_min'), 2), 'amount_min' => round($this->get('amount_min'), 2),
'amount_currency_id' => round($this->get('amount_currency_id'), 2), 'amount_currency_id_amount_min' => intval($this->get('amount_currency_id_amount_min')),
'amount_max' => round($this->get('amount_max'), 2), 'amount_currency_id_amount_max' => intval($this->get('amount_currency_id_amount_max')),
'date' => new Carbon($this->get('date')), 'amount_max' => round($this->get('amount_max'), 2),
'user' => Auth::user()->id, 'date' => new Carbon($this->get('date')),
'repeat_freq' => $this->get('repeat_freq'), 'user' => Auth::user()->id,
'skip' => intval($this->get('skip')), 'repeat_freq' => $this->get('repeat_freq'),
'automatch' => intval($this->get('automatch')) === 1, 'skip' => intval($this->get('skip')),
'active' => intval($this->get('active')) === 1, 'automatch' => intval($this->get('automatch')) === 1,
'active' => intval($this->get('active')) === 1,
]; ];
} }
@ -56,16 +57,17 @@ class BillFormRequest extends Request
} }
$rules = [ $rules = [
'name' => $nameRule, 'name' => $nameRule,
'match' => $matchRule, 'match' => $matchRule,
'amount_min' => 'required|numeric|min:0.01', 'amount_min' => 'required|numeric|min:0.01',
'amount_max' => 'required|numeric|min:0.01', 'amount_max' => 'required|numeric|min:0.01',
'amount_currency_id' => 'required|exists:transaction_currencies,id', 'amount_currency_id_amount_min' => 'required|exists:transaction_currencies,id',
'date' => 'required|date', 'amount_currency_id_amount_max' => 'required|exists:transaction_currencies,id',
'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly', 'date' => 'required|date',
'skip' => 'required|between:0,31', 'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly',
'automatch' => 'in:1', 'skip' => 'required|between:0,31',
'active' => 'in:1', 'automatch' => 'in:1',
'active' => 'in:1',
]; ];
return $rules; return $rules;