- 新增2个migration(11张表): finance(6表)/hr(5表) - 新增11个Model + 11个Controller - 新增50条API路由(总计262条) - 新增2个前端API模块 + 10个管理页面 - 迁移运行通过, vite build验证通过
38 lines
871 B
PHP
38 lines
871 B
PHP
<?php
|
|
|
|
namespace App\Models\Finance;
|
|
|
|
use App\Models\Crm\Customer;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class AccountTransaction extends Model
|
|
{
|
|
const UPDATED_AT = null;
|
|
|
|
protected $fillable = [
|
|
'store_id', 'customer_account_id', 'customer_id', 'type',
|
|
'amount', 'balance_after', 'related_type', 'related_id',
|
|
'description', 'operator_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'type' => 'integer',
|
|
'amount' => 'decimal:2',
|
|
'balance_after' => 'decimal:2',
|
|
];
|
|
}
|
|
|
|
public function account(): BelongsTo
|
|
{
|
|
return $this->belongsTo(CustomerAccount::class, 'customer_account_id');
|
|
}
|
|
|
|
public function customer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Customer::class);
|
|
}
|
|
}
|