added attribute casting
This commit is contained in:
@ -17,6 +17,16 @@ class Reconciliation extends Model
|
||||
*/
|
||||
protected $fillable = ['company_id', 'account_id', 'started_at', 'ended_at', 'closing_balance', 'reconciled'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'closing_balance' => 'double',
|
||||
'reconciled' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Sortable columns.
|
||||
*
|
||||
@ -28,15 +38,4 @@ class Reconciliation extends Model
|
||||
{
|
||||
return $this->belongsTo('App\Models\Banking\Account');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert closing balance to double.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function setClosingBalanceAttribute($value)
|
||||
{
|
||||
$this->attributes['closing_balance'] = (double) $value;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user