feat: notification on filament dashboard
This commit is contained in:
@@ -10,7 +10,7 @@ use App\Models\MealPosts;
|
||||
use App\Models\ModerationCase;
|
||||
use App\Models\Report;
|
||||
use App\Models\User;
|
||||
use App\Notifications\ModerationThresholdReached;
|
||||
use Filament\Notifications\Notification as FilamentNotification;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -112,7 +112,14 @@ class ModerationReportService
|
||||
User::query()
|
||||
->whereIn('role', [UserRole::ADMIN->value, UserRole::MODERATOR->value])
|
||||
->get()
|
||||
->each(fn (User $moderator): mixed => $moderator->notify(new ModerationThresholdReached($freshCase)));
|
||||
->whenNotEmpty(fn ($moderators) => FilamentNotification::make()
|
||||
->title(__('api.notifications.moderation_threshold_title'))
|
||||
->body(__('api.notifications.moderation_threshold_body', [
|
||||
'type' => $freshCase->targetLabel(),
|
||||
'count' => $freshCase->reports_count,
|
||||
]))
|
||||
->warning()
|
||||
->sendToDatabase($moderators, isEventDispatched: true));
|
||||
}
|
||||
|
||||
private function abortIfInvalidTarget(Model $reportable, User $reporter): void
|
||||
|
||||
Reference in New Issue
Block a user