Cleaned up some icons, improved routine for repeated expenses.

This commit is contained in:
James Cole
2015-03-21 21:33:52 +01:00
parent 1d6f6d28c9
commit f50b133f2e
26 changed files with 221 additions and 105 deletions

View File

@@ -14,7 +14,9 @@ class PiggyBank extends Model
{
use SoftDeletes;
protected $fillable = ['repeats', 'name', 'account_id','rep_every', 'rep_times', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder','remind_me'];
protected $fillable
= ['repeats', 'name', 'account_id', 'rep_every', 'rep_times', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder', 'remind_me',
'rep_length'];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
@@ -24,15 +26,6 @@ class PiggyBank extends Model
return $this->belongsTo('FireflyIII\Models\Account');
}
/**
* @param $value
*
* @return int
*/
public function getRemindMeAttribute($value) {
return intval($value) == 1;
}
/**
* Grabs the PiggyBankRepetition that's currently relevant / active
*
@@ -40,10 +33,10 @@ class PiggyBank extends Model
*/
public function currentRelevantRep()
{
if ($this->currentRep) {
if (!is_null($this->currentRep)) {
return $this->currentRep;
}
if ($this->repeats == 0) {
if (intval($this->repeats) === 0) {
$rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']);
$this->currentRep = $rep;
@@ -104,6 +97,16 @@ class PiggyBank extends Model
return ['created_at', 'updated_at', 'deleted_at', 'startdate', 'targetdate'];
}
/**
* @param $value
*
* @return int
*/
public function getRemindMeAttribute($value)
{
return intval($value) == 1;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/