fix: null check budget, cegah duplikasi approval/vote, tambah related_type di votes
This commit is contained in:
@@ -41,13 +41,14 @@ class CashRecordObserver
|
||||
// Threshold: > 2jt → buat voting + notif semua anggota
|
||||
if ($record->amount > 2_000_000) {
|
||||
Vote::create([
|
||||
'title' => "Persetujuan Transaksi: {$record->description}",
|
||||
'description' => "Transaksi senilai Rp " . number_format($record->amount, 0, ',', '.') . " memerlukan persetujuan voting.",
|
||||
'type' => 'finance',
|
||||
'related_id' => $record->id,
|
||||
'status' => 'open',
|
||||
'deadline' => now()->addDays(3),
|
||||
'created_by' => Auth::id() ?? $record->created_by,
|
||||
'title' => "Persetujuan Transaksi: {$record->description}",
|
||||
'description' => "Transaksi senilai Rp " . number_format($record->amount, 0, ',', '.') . " memerlukan persetujuan voting.",
|
||||
'type' => 'finance',
|
||||
'related_id' => $record->id,
|
||||
'related_type' => CashRecord::class,
|
||||
'status' => 'open',
|
||||
'deadline' => now()->addDays(3),
|
||||
'created_by' => Auth::id() ?? $record->created_by,
|
||||
]);
|
||||
|
||||
NotificationService::toRole('ketua',
|
||||
|
||||
Reference in New Issue
Block a user