2026-01-26 10:37:47 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Modules\Finance\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class UtilityFee extends Model
|
|
|
|
|
{
|
|
|
|
|
/** @use HasFactory<\Database\Factories\UtilityFeeFactory> */
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
|
|
protected $fillable = [
|
2026-01-26 14:59:24 +08:00
|
|
|
'transaction_date',
|
|
|
|
|
'category',
|
2026-01-26 10:37:47 +08:00
|
|
|
'amount',
|
2026-01-26 14:59:24 +08:00
|
|
|
'invoice_number',
|
|
|
|
|
'description',
|
2026-01-26 10:37:47 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $casts = [
|
2026-01-26 14:59:24 +08:00
|
|
|
'transaction_date' => 'date',
|
2026-01-26 10:37:47 +08:00
|
|
|
'amount' => 'decimal:2',
|
|
|
|
|
];
|
2026-01-26 14:59:24 +08:00
|
|
|
|
|
|
|
|
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'),
|
|
|
|
|
'category' => $this->category,
|
|
|
|
|
'amount' => $this->amount,
|
|
|
|
|
'invoice_number' => $this->invoice_number,
|
|
|
|
|
]);
|
|
|
|
|
}
|
2026-01-26 10:37:47 +08:00
|
|
|
}
|