mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-26 05:26:17 +00:00
Updated a lot of small things, new triggers for future reminder and some cleanup.
This commit is contained in:
@@ -1,26 +1,25 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Class PiggybankRepetition
|
||||
* PiggybankRepetition
|
||||
*
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $piggybank_id
|
||||
* @property \Carbon\Carbon $targetdate
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property float $currentamount
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $piggybank_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property \Carbon\Carbon $targetdate
|
||||
* @property float $currentamount
|
||||
* @property-read \Piggybank $piggybank
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition wherePiggybankId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereTargetdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereCurrentamount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition wherePiggybankId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereTargetdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereCurrentamount($value)
|
||||
*/
|
||||
class PiggybankRepetition extends Ardent
|
||||
{
|
||||
@@ -32,14 +31,6 @@ class PiggybankRepetition extends Ardent
|
||||
'currentamount' => 'required|numeric'
|
||||
];
|
||||
|
||||
|
||||
public function pct() {
|
||||
$total = $this->piggybank->targetamount;
|
||||
$saved = $this->currentamount;
|
||||
$pct = round(($saved / $total) * 100,1);
|
||||
return $pct;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@@ -48,6 +39,18 @@ class PiggybankRepetition extends Ardent
|
||||
return ['created_at', 'updated_at', 'targetdate', 'startdate'];
|
||||
}
|
||||
|
||||
public function pct()
|
||||
{
|
||||
$total = $this->piggybank->targetamount;
|
||||
$saved = $this->currentamount;
|
||||
if ($total == 0) {
|
||||
return 0;
|
||||
}
|
||||
$pct = round(($saved / $total) * 100, 1);
|
||||
|
||||
return $pct;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user