38 lines
733 B
PHP
38 lines
733 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class LimitJournal extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'journalable',
|
|
'previous_balance',
|
|
'total_credit',
|
|
'total_debit',
|
|
'type',
|
|
'balance',
|
|
'description',
|
|
];
|
|
|
|
public function journalable()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function setTotalCreditAttribute($value)
|
|
{
|
|
$this->attributes['total_credit'] = empty($value) ? 0 : $value;
|
|
}
|
|
|
|
public function setTotalDebitAttribute($value)
|
|
{
|
|
$this->attributes['total_debit'] = empty($value) ? 0 : $value;
|
|
}
|
|
|
|
}
|