/home/techb158/ileadtechnology.com/SSM/app/Models/finance
Edit: /home/techb158/ileadtechnology.com/SSM/app/Models/finance/Account.php (2025B)
'array'];
protected $primaryKey = 'id';
protected $table = 'accounts';
protected static $logName = 'account';
protected static $logFillable = true;
protected static $logOnlyDirty = true;
protected static $ignoreChangedAttributes = ['updated_at'];
public function transactions()
{
return $this->hasMany('App\Models\Finance\Transaction\Transaction');
}
public function toAccountTransfers()
{
return $this->hasMany('App\Models\Finance\Transaction\AccountTransfer', 'to_account_id');
}
public function fromAccountTransfers()
{
return $this->hasMany('App\Models\Finance\Transaction\AccountTransfer', 'from_account_id');
}
public function getOption(string $option)
{
return array_get($this->options, $option);
}
public function scopeFilterById($q, $id)
{
if (! $id) {
return $q;
}
return $q->where('id', '=', $id);
}
public function scopeFilterByIsActive($q, $is_active)
{
return $q->where('is_active', '=', $is_active);
}
public function scopeFilterByName($q, $name, $strict = 0)
{
if (! $name) {
return $q;
}
return ($strict) ? $q->where('name', '=', $name) : $q->where('name', 'like', '%'.$name.'%');
}
}