initial: bootstrap from BukidBountyApp base

This commit is contained in:
Jonathan Sykes
2026-06-06 18:43:00 +08:00
commit eb4a5731fb
5674 changed files with 160857 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?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');
}
}

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Models\Accounting;
use App\Models\Model;
use App\Models\User;
class AccountTransaction extends Model
{
protected ?string $table = 'account_transactions';
protected array $fillable = [
'hashkey',
'account_id',
'item',
'target_id',
'amount',
'flow',
'notes',
'transaction_date',
'reference',
'additional_details',
'created_by',
'updated_by',
];
protected array $casts = [
'additional_details' => 'json',
'amount' => 'decimal:2',
'transaction_date' => 'datetime',
];
public function account()
{
return $this->belongsTo(Account::class, 'account_id');
}
public function creator()
{
return $this->belongsTo(User::class, 'created_by');
}
public function updater()
{
return $this->belongsTo(User::class, 'updated_by');
}
}

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace App\Models\Accounting;
use App\Models\Model;
use App\Models\User;
use App\Models\Market\Organization;
class MemberLedger extends Model
{
protected ?string $table = 'member_ledgers';
protected array $fillable = [
'hashkey',
'user_id',
'organization_id',
'amount',
'transaction_type',
'flow',
'balance_after',
'description',
'reference_id',
'created_by',
'updated_by',
'is_active',
];
protected array $casts = [
'amount' => 'decimal:2',
'balance_after' => 'decimal:2',
'is_active' => 'boolean',
];
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
public function organization()
{
return $this->belongsTo(Organization::class, 'organization_id');
}
public function creator()
{
return $this->belongsTo(User::class, 'created_by');
}
public function updater()
{
return $this->belongsTo(User::class, 'updated_by');
}
}