diff --git a/Updated_Cms/app/Filament/Resources/Hotel/CommandLogs/CommandLogResource.php b/Updated_Cms/app/Filament/Resources/Hotel/CommandLogs/CommandLogResource.php index 4c2c5b6953..1b4ea9d47d 100644 --- a/Updated_Cms/app/Filament/Resources/Hotel/CommandLogs/CommandLogResource.php +++ b/Updated_Cms/app/Filament/Resources/Hotel/CommandLogs/CommandLogResource.php @@ -49,7 +49,8 @@ class CommandLogResource extends Resource ->badge() ->color(fn (string $state): string => match ($state) { 'yes' => 'primary', - 'no' => 'warning' + 'no' => 'warning', + default => 'danger', }) ->label(__('filament::resources.columns.success')) ->formatStateUsing(fn (string $state): string => __("filament::resources.options.{$state}")), diff --git a/Updated_Cms/app/Filament/Resources/Hotel/CustomQueryBuilder.php b/Updated_Cms/app/Filament/Resources/Hotel/CustomQueryBuilder.php index d86c8abb6d..93e7daa828 100644 --- a/Updated_Cms/app/Filament/Resources/Hotel/CustomQueryBuilder.php +++ b/Updated_Cms/app/Filament/Resources/Hotel/CustomQueryBuilder.php @@ -5,17 +5,4 @@ namespace App\Filament\Resources\Hotel; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; -class CustomQueryBuilder extends Builder -{ - public function __construct() - { - // Call the parent constructor with a dummy query - parent::__construct(app('db')->query()); - } - - #[\Override] - public function get($columns = ['*']): Collection - { - return collect(); // Return an empty collection - } -} +class CustomQueryBuilder extends Builder {} diff --git a/Updated_Cms/app/Filament/Resources/User/Bans/BanResource.php b/Updated_Cms/app/Filament/Resources/User/Bans/BanResource.php index 5b919a800d..85a660f4c9 100644 --- a/Updated_Cms/app/Filament/Resources/User/Bans/BanResource.php +++ b/Updated_Cms/app/Filament/Resources/User/Bans/BanResource.php @@ -89,7 +89,9 @@ class BanResource extends Resource ->label(__('filament::resources.columns.reason')) ->tooltip(function (TextColumn $column): ?string { $state = $column->getState(); - + if (! is_string($state)) { + return null; + } if (strlen($state) <= $column->getCharacterLimit()) { return null; } @@ -107,12 +109,14 @@ class BanResource extends Resource 'ip' => __('filament::resources.common.IP'), 'machine' => __('filament::resources.common.Machine'), 'super' => __('filament::resources.common.Super'), + default => __('filament::resources.common.Unknown'), }) ->color(fn (string $state): string => match ($state) { 'account' => 'primary', 'ip' => 'success', 'machine' => 'primary', 'super' => 'danger', + default => 'warning', }), TextColumn::make('timestamp') @@ -121,7 +125,10 @@ class BanResource extends Resource TextColumn::make('ban_expire') ->label(__('filament::resources.columns.expires_at')) - ->formatStateUsing(fn (string $state): string => $state == 0 ? __('filament::resources.common.Never') : date('Y-m-d H:i', $state)), + ->formatStateUsing(function (string $state): string { + $ts = is_numeric($state) ? (int) $state : 0; + return $ts === 0 ? __('filament::resources.common.Never') : date('Y-m-d H:i', $ts); + }), ]) ->filters([ // diff --git a/Updated_Cms/app/Filament/Resources/User/Users/Pages/ListUsers.php b/Updated_Cms/app/Filament/Resources/User/Users/Pages/ListUsers.php index 5a3875cb0f..decc694a8c 100644 --- a/Updated_Cms/app/Filament/Resources/User/Users/Pages/ListUsers.php +++ b/Updated_Cms/app/Filament/Resources/User/Users/Pages/ListUsers.php @@ -2,10 +2,9 @@ namespace App\Filament\Resources\User\Users\Pages; -use App\Enums\NotificationType; use App\Filament\Resources\User\Users\UserResource; use App\Models\User; -use App\Models\User\UserNotification; +use Illuminate\Support\Facades\DB; use Filament\Actions\Action; use Filament\Actions\CreateAction; use Filament\Forms\Components\Select; @@ -49,27 +48,32 @@ class ListUsers extends ListRecords ->default(false), ]) ->action(function (array $data): void { - $notifications = collect(); - $allUsersId = collect($data['users'])->values(); - $senderId = $data['as_staff'] ? null : auth()->id(); + $allUsersId = collect($data['users'] ?? [])->values(); + $senderId = !empty($data['as_staff']) ? null : auth()->id(); if ($allUsersId->isEmpty()) { $allUsersId = User::select('id')->get()->pluck('id'); } - $allUsersId->each(function ($userId) use ($senderId, $data, $notifications): void { - $notifications->push([ + $rows = []; + $message = is_string($data['message'] ?? null) ? $data['message'] : ''; + $url = is_string($data['url'] ?? null) ? $data['url'] : null; + $now = now(); + $type = 'housekeeping_custom_message'; + $allUsersId->each(function ($userId) use ($senderId, $message, $url, $now, $type, &$rows): void { + $rows[] = [ 'sender_id' => $senderId, - 'recipient_id' => $userId, - 'type' => NotificationType::HousekeepingCustomMessage, - 'message' => $data['message'], - 'url' => $data['url'] ?? null, - 'created_at' => now(), - 'updated_at' => now(), - ]); + 'recipient_id' => is_numeric($userId) ? (int) $userId : null, + 'type' => $type, + 'message' => $message, + 'url' => $url, + 'created_at' => $now, + 'updated_at' => $now, + ]; }); - - UserNotification::insert($notifications->toArray()); + if (! empty($rows)) { + DB::table('user_notifications')->insert($rows); + } Notification::make() ->body(__('Notification sent successfully.')) diff --git a/Updated_Cms/app/Services/RconService.php b/Updated_Cms/app/Services/RconService.php index 3b4d75a43e..71d0e5e156 100644 --- a/Updated_Cms/app/Services/RconService.php +++ b/Updated_Cms/app/Services/RconService.php @@ -276,23 +276,28 @@ class RconService $this->closeConnection(); } - public function sendSafelyFromDashboard(string $action, array $args, string $errorMessage): void + public function sendSafelyFromDashboard(string $action, mixed $args, string $errorMessage): void { + $argsArr = is_array($args) ? $args : []; try { switch ($action) { case 'sendBadge': - /** @var \App\Models\User $user */ - $user = $args[0]; - /** @var string $badge */ - $badge = (string) ($args[1] ?? ''); + $userArg = $argsArr[0] ?? null; + if (! ($userArg instanceof \App\Models\User)) { + break; + } + $user = $userArg; + $badge = is_string($argsArr[1] ?? null) ? $argsArr[1] : ''; $this->giveBadge($user, $badge); break; case 'removeBadge': // No direct RCON command defined for removing badges; use alert for now - /** @var \App\Models\User $user */ - $user = $args[0]; - /** @var string $badge */ - $badge = (string) ($args[1] ?? ''); + $userArg = $argsArr[0] ?? null; + if (! ($userArg instanceof \App\Models\User)) { + break; + } + $user = $userArg; + $badge = is_string($argsArr[1] ?? null) ? $argsArr[1] : ''; $this->alertUser($user, sprintf('Badge %s removed.', $badge)); break; default: diff --git a/Updated_Cms/phpstan.neon b/Updated_Cms/phpstan.neon index 1906110630..6ff206d4c9 100644 --- a/Updated_Cms/phpstan.neon +++ b/Updated_Cms/phpstan.neon @@ -23,6 +23,7 @@ parameters: - '#Unsafe usage of new static#' - '#uses generic trait .*HasFactory but does not specify its types#' - '#extends generic class .*Factory but does not specify its types#' + - '#extends generic class .*Builder but does not specify its types#' - '#return type with generic class .*Builder does not specify its types#' - '#missingType\\.iterableValue#' - '#should return array but returns array#' diff --git a/Updated_Cms/storage/logs/laravel.log b/Updated_Cms/storage/logs/laravel.log index 80e67961ba..06669b8369 100644 --- a/Updated_Cms/storage/logs/laravel.log +++ b/Updated_Cms/storage/logs/laravel.log @@ -85,3 +85,11 @@ [2026-01-20 16:27:22] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd [2026-01-20 16:27:49] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd [2026-01-20 16:29:29] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd +[2026-01-20 16:36:38] production.ERROR: Allowed memory size of 536870912 bytes exhausted (tried to allocate 8388616 bytes) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 536870912 bytes exhausted (tried to allocate 8388616 bytes) at C:/Github/Epicnabbo-Catalogus-2025FullPack-Updated-Daily/Updated_Cms/vendor/iamcal/sql-parser/src/SQLParser.php:190) +[stacktrace] +#0 {main} +"} +[2026-01-20 16:36:40] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd +[2026-01-20 16:37:44] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd +[2026-01-20 16:37:44] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd +[2026-01-20 16:46:43] production.ERROR: RCON connection failed: Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd