feat(admin): improve payments and server settings

This commit is contained in:
baodev0
2026-10-19 07:59:23 +07:00
parent 9ed77a85fd
commit ea9a53f742
32 changed files with 680 additions and 78 deletions
+20 -2
View File
@@ -2,11 +2,11 @@
namespace App\Models;
use App\Events\AdminNotificationCreated;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\Customer;
use App\Models\User;
use Illuminate\Support\Facades\Log;
class Notification extends Model
{
@@ -58,5 +58,23 @@ class Notification extends Model
...$attributes,
]);
}
if ($adminIds->isEmpty()) {
return;
}
try {
broadcast(new AdminNotificationCreated(
type: (string) ($attributes['type'] ?? 'system'),
title: (string) ($attributes['title'] ?? 'Có thông báo mới'),
body: isset($attributes['body']) ? (string) $attributes['body'] : null,
link: isset($attributes['link']) ? (string) $attributes['link'] : null,
));
} catch (\Throwable $e) {
Log::warning('Không thể phát thông báo realtime cho quản trị viên.', [
'type' => $attributes['type'] ?? null,
'error' => $e->getMessage(),
]);
}
}
}