fix: implementasi FilamentUser interface agar panel bisa diakses di production
- Tambah FilamentUser interface di User model - Tambah canAccessPanel() method - Tambah VoteObserver: broadcast notifikasi ke semua user saat vote baru - Tambah NotificationService::toAll() - Fix Vote model: auto-fill created_by via booted() - Fix CashRecordObserver: fallback created_by untuk Vote
This commit is contained in:
@@ -47,7 +47,7 @@ class CashRecordObserver
|
||||
'related_id' => $record->id,
|
||||
'status' => 'open',
|
||||
'deadline' => now()->addDays(3),
|
||||
'created_by' => Auth::id(),
|
||||
'created_by' => Auth::id() ?? $record->created_by,
|
||||
]);
|
||||
|
||||
NotificationService::toRole('ketua',
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Vote;
|
||||
use App\Services\NotificationService;
|
||||
|
||||
class VoteObserver
|
||||
{
|
||||
public function created(Vote $vote): void
|
||||
{
|
||||
NotificationService::toAll(
|
||||
'Voting Baru Dibuat',
|
||||
"Voting \"{$vote->title}\" telah dibuka. Silakan berikan suara Anda.",
|
||||
'info',
|
||||
route('filament.admin.resources.votes.index')
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user