This commit is contained in:
Mekan1206
2026-05-01 16:53:04 +05:00
parent f772562376
commit 005b428cf1
12 changed files with 261 additions and 2 deletions

View File

@@ -101,6 +101,13 @@ Route::get('filters', [FilterController::class, 'index']);
// Global orders...
Route::post('global-order', [GlobalOrderController::class, 'store']);
Route::middleware('auth:sanctum')->group(function () {
Route::get('/chat/contacts', [ChatController::class, 'contacts']);
Route::get('/chat/messages/{conversation}', [ChatController::class, 'messages']);
Route::post('/chat/start', [ChatController::class, 'start']);
Route::post('/chat/send', [ChatController::class, 'send']);
});
Route::middleware(['auth:sanctum', 'banned'])->group(function () {
// Profile...
Route::get('profile', [ProfileController::class, 'index']);

View File

@@ -1,6 +1,7 @@
<?php
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\Facades\DB;
/*
|--------------------------------------------------------------------------
@@ -12,3 +13,10 @@ use Illuminate\Support\Facades\Broadcast;
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) {
return DB::table('conversation_user')
->where('conversation_id', $conversationId)
->where('user_id', $user->id)
->exists();
});