Files
pterodactyl-panel/app/Providers/BroadcastServiceProvider.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

30 lines
665 B
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
use Pterodactyl\Models\User;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Broadcast::routes();
/*
* Authenticate the user's personal channel...
*/
Broadcast::channel('App.User.*', function (User $user, string $userId): bool {
$id = filter_var($userId, FILTER_VALIDATE_INT);
return $id !== false && $user->id === $id;
});
}
}