More work on the budget controller [skip ci]

This commit is contained in:
James Cole
2014-07-27 22:48:13 +02:00
parent 3c97a1018a
commit 2680cd8b7a
8 changed files with 130 additions and 81 deletions

View File

@@ -121,7 +121,7 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
$budget->save();
// if limit, create limit (repetition itself will be picked up elsewhere).
if ($data['amount'] > 0) {
if (floatval($data['amount']) > 0) {
$limit = new \Limit;
$limit->budget()->associate($budget);
$startDate = new Carbon;
@@ -152,10 +152,13 @@ class EloquentBudgetRepository implements BudgetRepositoryInterface
$limit->amount = $data['amount'];
$limit->repeats = $data['repeats'];
$limit->repeat_freq = $data['repeat_freq'];
$limit->save();
if ($limit->validate()) {
$limit->save();
}
}
if($budget->validate()) {
$budget->save();
}
return $budget;
}