14 lines
419 B
PHP
14 lines
419 B
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Broadcast;
|
|
|
|
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
|
return (int) $user->id === (int) $id;
|
|
});
|
|
|
|
Broadcast::channel('chat.{user1}.{user2}', function (User $user, int $user1, int $user2) {
|
|
// Only allow the user if their ID matches one of the two in the channel name
|
|
return $user->id === $user1 || $user->id === $user2;
|
|
});
|