ConvoyPanel/routes/channels.php
2022-10-10 00:18:22 +00:00

27 lines
794 B
PHP

<?php
use Convoy\Models\Server;
use Illuminate\Support\Facades\Broadcast;
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('server.{id}', function ($user, $id) {
return (int) $user->id === (int) Server::find($id)->user_id || (bool) $user->root_admin;
});
Broadcast::channel('user.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
Broadcast::channel('public', function () {
return true;
});