21 lines
515 B
PHP
21 lines
515 B
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Broadcast;
|
|
|
|
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
|
return (int) $user->id === (int) $id;
|
|
});
|
|
|
|
// 🛡️ ROLE BASED CHANNELS (Dynamic)
|
|
Broadcast::channel('roles.{roleName}', function ($user, $roleName) {
|
|
if ($user->hasAnyRole(['Developer', 'Administrator'])) {
|
|
return true;
|
|
}
|
|
|
|
return $user->hasRole($roleName);
|
|
});
|
|
|
|
Broadcast::channel('admin.monitoring', function ($user) {
|
|
return $user->can('view health and logs');
|
|
});
|