2018-10-27 17:57:40 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Banking;
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
use App\Abstracts\Model;
|
2018-10-27 17:57:40 +03:00
|
|
|
|
|
|
|
class Reconciliation extends Model
|
|
|
|
{
|
|
|
|
protected $table = 'reconciliations';
|
|
|
|
|
|
|
|
protected $dates = ['deleted_at', 'started_at', 'ended_at'];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attributes that should be mass-assignable.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $fillable = ['company_id', 'account_id', 'started_at', 'ended_at', 'closing_balance', 'reconciled'];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sortable columns.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
public $sortable = ['created_at', 'account_id', 'started_at', 'ended_at', 'closing_balance', 'reconciled'];
|
|
|
|
|
|
|
|
public function account()
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|