mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New stuff! [skip ci]
This commit is contained in:
@@ -37,6 +37,7 @@ class LimitRepetition extends Ardent
|
||||
$start->startOfMonth();
|
||||
$end = clone $start;
|
||||
$end->endOfMonth();
|
||||
|
||||
return [
|
||||
'limit_id' => 'factory|Limit',
|
||||
'startdate' => $start,
|
||||
@@ -45,11 +46,6 @@ class LimitRepetition extends Ardent
|
||||
];
|
||||
}
|
||||
|
||||
public function limit()
|
||||
{
|
||||
return $this->belongsTo('Limit');
|
||||
}
|
||||
|
||||
public function getDates()
|
||||
{
|
||||
return ['created_at', 'updated_at', 'startdate', 'enddate'];
|
||||
@@ -60,10 +56,6 @@ class LimitRepetition extends Ardent
|
||||
*/
|
||||
public function left()
|
||||
{
|
||||
$key = 'limit-rep-left-' . $this->id;
|
||||
if (Cache::has($key)) {
|
||||
return Cache::get($key);
|
||||
}
|
||||
$left = floatval($this->amount);
|
||||
|
||||
// budget:
|
||||
@@ -80,11 +72,14 @@ class LimitRepetition extends Ardent
|
||||
}
|
||||
}
|
||||
}
|
||||
Cache::forever($key, $left);
|
||||
|
||||
|
||||
return $left;
|
||||
}
|
||||
|
||||
public function limit()
|
||||
{
|
||||
return $this->belongsTo('Limit');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user