All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 57s
- 依循跨模組通訊規範,將 Sales 與 Production 模組中對 Inventory 的直接模型關聯改為透過 InventoryServiceInterface 取得 - 於 InventoryService 實作獲取最高庫存價值、即將過期商品等方法,供儀表板使用 - 確保所有跨模組調用皆採用手動水和(Manual Hydration)方式組合資料 - 移除本地已歸檔的 .agent 規範檔案
55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Finance\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class AccountPayable extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const STATUS_PENDING = 'pending';
|
|
public const STATUS_PARTIALLY_PAID = 'partially_paid';
|
|
public const STATUS_PAID = 'paid';
|
|
public const STATUS_CANCELLED = 'cancelled';
|
|
|
|
protected $fillable = [
|
|
'vendor_id',
|
|
'source_document_type',
|
|
'source_document_id',
|
|
'document_number',
|
|
'total_amount',
|
|
'tax_amount',
|
|
'status',
|
|
'due_date',
|
|
'invoice_number',
|
|
'invoice_date',
|
|
'paid_at',
|
|
'payment_method',
|
|
'payment_note',
|
|
'remarks',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'total_amount' => 'decimal:2',
|
|
'tax_amount' => 'decimal:2',
|
|
'due_date' => 'date',
|
|
'invoice_date' => 'date',
|
|
'paid_at' => 'datetime',
|
|
];
|
|
|
|
// vendor 關聯移至 service (跨模組)
|
|
|
|
/**
|
|
* 關聯:建立者
|
|
* @return BelongsTo
|
|
*/
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Modules\Core\Models\User::class, 'created_by');
|
|
}
|
|
}
|