Some changes to facilitate piggy bank events (see issue #6) and extra view info for clarity. [skip ci]

This commit is contained in:
James Cole
2014-08-18 12:28:33 +02:00
parent 5ac790433b
commit 87bddce1d3
7 changed files with 187 additions and 48 deletions

View File

@@ -42,18 +42,18 @@ class Piggybank extends Ardent
{
public static $rules
= [
'account_id' => 'required|exists:accounts,id', // link to Account
'name' => 'required|between:1,255', // name
'targetamount' => 'required|min:0', // amount you want to save
'startdate' => 'date', // when you started
'targetdate' => 'date', // when its due
'repeats' => 'required|between:0,1', // does it repeat?
'rep_length' => 'in:day,week,month,year', // how long is the period?
'rep_every' => 'required|min:1|max:100', // how often does it repeat? every 3 years.
'rep_times' => 'min:1|max:100', // how many times do you want to save this amount? eg. 3 times
'reminder' => 'in:day,week,month,year', // want a reminder to put money in this?
'account_id' => 'required|exists:accounts,id', // link to Account
'name' => 'required|between:1,255', // name
'targetamount' => 'required|min:0', // amount you want to save
'startdate' => 'date', // when you started
'targetdate' => 'date', // when its due
'repeats' => 'required|between:0,1', // does it repeat?
'rep_length' => 'in:day,week,month,year', // how long is the period?
'rep_every' => 'required|min:1|max:100', // how often does it repeat? every 3 years.
'rep_times' => 'min:1|max:100', // how many times do you want to save this amount? eg. 3 times
'reminder' => 'in:day,week,month,year', // want a reminder to put money in this?
'reminder_skip' => 'required|min:0|max:100', // every week? every 2 months?
'order' => 'required:min:1', // not yet used.
'order' => 'required:min:1', // not yet used.
];
public $fillable
= [
@@ -82,18 +82,18 @@ class Piggybank extends Ardent
$end->endOfMonth();
return [
'account_id' => 'factory|Account',
'name' => 'string',
'targetamount' => 'integer',
'startdate' => $start->format('Y-m-d'),
'targetdate' => $end->format('Y-m-d'),
'repeats' => 0,
'rep_length' => null,
'rep_times' => 0,
'rep_every' => 0,
'reminder' => null,
'account_id' => 'factory|Account',
'name' => 'string',
'targetamount' => 'integer',
'startdate' => $start->format('Y-m-d'),
'targetdate' => $end->format('Y-m-d'),
'repeats' => 0,
'rep_length' => null,
'rep_times' => 0,
'rep_every' => 0,
'reminder' => null,
'reminder_skip' => 0,
'order' => 1,
'order' => 1,
];
}
@@ -212,4 +212,12 @@ class Piggybank extends Ardent
return $this->hasMany('PiggybankRepetition');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function piggybankevents()
{
return $this->hasMany('PiggybankEvent');
}
}