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
+6
View File
@@ -16,6 +16,7 @@ class DnsServer extends Model
protected $fillable = [
'name',
'ip_address',
'domain',
'panel_port',
'password',
'username',
@@ -31,6 +32,11 @@ class DnsServer extends Model
return in_array($type, [ServerType::HOSTING->value, ServerType::BOTH->value], true);
}
public function publicHost(): string
{
return $this->domain ?: $this->ip_address;
}
protected function scopeIsActive($query)
{
return $query->where('status', 'activated');
+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(),
]);
}
}
}
+1 -1
View File
@@ -30,7 +30,7 @@ class Service extends Model
protected $table = 'services';
public const HOSTING_ACCOUNT_RELATIONS = [
'hostingAccount.server:id,name,ip_address',
'hostingAccount.server:id,name,ip_address,domain,panel_port',
'hostingAccount.domain:id,domain_name',
];