fix: PostObserver trigger published, submit cek kreator, toAll filter aktif, dead code

This commit is contained in:
2026-04-06 00:27:32 +07:00
parent a855ad92fb
commit 9c457bffde
4 changed files with 5 additions and 4 deletions
@@ -52,7 +52,8 @@ class ActivitiesTable
->icon('heroicon-o-paper-airplane')
->color('info')
->requiresConfirmation()
->visible(fn ($record) => $record->status === 'draft')
->visible(fn ($record) => $record->status === 'draft'
&& $record->created_by === auth()->id())
->action(fn ($record) => $record->update(['status' => 'pending'])),
Action::make('approve')
->label('Setujui')
+1 -1
View File
@@ -23,7 +23,7 @@ class CashRecordObserver
// Threshold: 500rb2jt → buat approval ketua + notif
if ($record->amount >= 500_000 && $record->amount <= 2_000_000) {
$approval = Approval::create([
Approval::create([
'model_type' => CashRecord::class,
'model_id' => $record->id,
'required_approvals' => 1,
+1 -1
View File
@@ -9,7 +9,7 @@ class PostObserver
{
public function updated(Post $post): void
{
if ($post->wasChanged('status') && $post->status === 'approved') {
if ($post->wasChanged('status') && $post->status === 'published') {
MemberPoint::firstOrCreate(
[
'user_id' => $post->author_id,
+1 -1
View File
@@ -36,6 +36,6 @@ class NotificationService
public static function toAll(string $title, string $body, string $color = 'info', ?string $url = null): void
{
self::send(User::all(), $title, $body, $color, $url);
self::send(User::where('status', 'aktif')->get(), $title, $body, $color, $url);
}
}