initial: bootstrap from BukidBountyApp base
This commit is contained in:
57
app/Models/Accounting/Account.php
Normal file
57
app/Models/Accounting/Account.php
Normal 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');
|
||||
}
|
||||
}
|
||||
49
app/Models/Accounting/AccountTransaction.php
Normal file
49
app/Models/Accounting/AccountTransaction.php
Normal 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');
|
||||
}
|
||||
}
|
||||
55
app/Models/Accounting/MemberLedger.php
Normal file
55
app/Models/Accounting/MemberLedger.php
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user