se cargan modulos de chat en tiempo real
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
||||
return (int) $user->id === (int) $id;
|
||||
});
|
||||
|
||||
Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) {
|
||||
|
||||
return \App\Models\Conversation::where('id', $conversationId)
|
||||
->whereHas('users', fn ($q) =>
|
||||
$q->where('user_id', $user->id)
|
||||
)->exists();
|
||||
});
|
||||
Reference in New Issue
Block a user