fixed #36
This commit is contained in:
@ -84,6 +84,28 @@ class Bill extends Model
|
||||
return $this->hasMany('App\Models\Expense\BillHistory');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert amount to float.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setAmountAttribute($value)
|
||||
{
|
||||
$this->attributes['amount'] = (float) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert currency rate to float.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setCurrencyRateAttribute($value)
|
||||
{
|
||||
$this->attributes['currency_rate'] = (float) $value;
|
||||
}
|
||||
|
||||
public function scopeDue($query, $date)
|
||||
{
|
||||
return $query->where('due_at', '=', $date);
|
||||
|
@ -64,6 +64,28 @@ class Payment extends Model
|
||||
return $this->hasMany('App\Models\Banking\Transfer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert amount to float.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setAmountAttribute($value)
|
||||
{
|
||||
$this->attributes['amount'] = (float) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert currency rate to float.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setCurrencyRateAttribute($value)
|
||||
{
|
||||
$this->attributes['currency_rate'] = (float) $value;
|
||||
}
|
||||
|
||||
public static function scopeLatest($query)
|
||||
{
|
||||
return $query->orderBy('paid_at', 'desc');
|
||||
|
Reference in New Issue
Block a user