Files
BarangaySystem/app/Models/Accounting/Account.php
2026-06-06 18:43:00 +08:00

58 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Models\Accounting;
use App\Models\Model;
use App\Models\User;
class Account extends Model
{
protected ?string $table = 'accounts';
protected array $fillable = [
'hashkey',
'parent_id',
'store_id',
'type',
'default_flow',
'name',
'description',
'theme_key',
'theme_account_code',
'is_active',
'created_by',
'updated_by',
];
protected array $casts = [
'is_active' => 'boolean',
];
public function parent()
{
return $this->belongsTo(self::class, 'parent_id');
}
public function children()
{
return $this->hasMany(self::class, 'parent_id');
}
public function creator()
{
return $this->belongsTo(User::class, 'created_by');
}
public function updater()
{
return $this->belongsTo(User::class, 'updated_by');
}
public function transactions()
{
return $this->hasMany(AccountTransaction::class, 'account_id');
}
}