[FEAT] 實作公共事業費逾期提醒、租戶自訂通知設定及發送測試信功能
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 56s

This commit is contained in:
2026-03-05 16:01:00 +08:00
parent 016366407c
commit 07b7d9b327
15 changed files with 519 additions and 44 deletions

View File

@@ -10,26 +10,37 @@ class UtilityFee extends Model
/** @use HasFactory<\Database\Factories\UtilityFeeFactory> */
use HasFactory;
// 狀態常數
const STATUS_PENDING = 'pending';
const STATUS_PAID = 'paid';
const STATUS_OVERDUE = 'overdue';
protected $fillable = [
'transaction_date',
'due_date',
'category',
'amount',
'payment_status',
'invoice_number',
'description',
];
protected $casts = [
'transaction_date' => 'date:Y-m-d',
'due_date' => 'date:Y-m-d',
'amount' => 'decimal:2',
];
public function tapActivity(\Spatie\Activitylog\Contracts\Activity $activity, string $eventName)
{
$activity->properties = $activity->properties->put('snapshot', [
'transaction_date' => $this->transaction_date->format('Y-m-d'),
$snapshot = [
'transaction_date' => $this->transaction_date?->format('Y-m-d'),
'due_date' => $this->due_date?->format('Y-m-d'),
'category' => $this->category,
'amount' => $this->amount,
'payment_status' => $this->payment_status,
'invoice_number' => $this->invoice_number,
]);
];
$activity->properties = $activity->properties->put('snapshot', $snapshot);
}
}