Implement chat support functionality: update .env.example for Reverb integration, enhance ChatController with support conversation methods, and modify Conversation model for improved chat handling. Add middleware for chat operator checks and update broadcasting configuration for Reverb.
This commit is contained in:
1 parent
ccfffe6173
commit
da530f6b36
21 files changed
+2034
-39
No files matched your search
+13
-1
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Support\ChatSupport;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -15,8 +16,19 @@
|
||||
*/
|
||||
|
||||
Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) {
|
||||
return DB::table('conversation_user')
|
||||
$isParticipant = DB::table('conversation_user')
|
||||
->where('conversation_id', $conversationId)
|
||||
->where('user_id', $user->id)
|
||||
->exists();
|
||||
|
||||
if ($isParticipant) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return ChatSupport::isOperator($user)
|
||||
&& ChatSupport::conversationIncludesSupport((int) $conversationId);
|
||||
});
|
||||
|
||||
Broadcast::channel('chat.support', function ($user) {
|
||||
return ChatSupport::isOperator($user);
|
||||
});
|
||||
Reference in new issue
Block a user