Refactor chat functionality: remove ChatController, enhance MessageSent event with broadcasting capabilities, and update Conversation and Message models for improved relationships. Update API routes for chat operations and adjust CORS settings for broadcasting authentication.

This commit is contained in:
Mekan1206 committed 2026-08-15 16:07:23 +05:00
1 parent b52b567388
commit ccfffe6173
23 files changed
+425 -198

No files matched your search

+9 -7
View File
@@ -7,6 +7,7 @@
use App\Http\Controllers\Api\V1\CartController;
use App\Http\Controllers\Api\V1\Category\CategoryController;
use App\Http\Controllers\Api\V1\Channel\ChannelController;
use App\Http\Controllers\Api\V1\Chat\ChatController;
use App\Http\Controllers\Api\V1\Collection\CollectionController;
use App\Http\Controllers\Api\V1\ContactMessageController;
use App\Http\Controllers\Api\V1\Favorite\FavoriteController;
@@ -107,18 +108,19 @@
// 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']);
Route::post('profile', [ProfileController::class, 'store']);
// Chat...
Route::get('chat/conversations', [ChatController::class, 'conversations']);
Route::get('chat/contacts', [ChatController::class, 'contacts']);
Route::post('chat/start', [ChatController::class, 'start']);
Route::get('chat/conversations/{conversation}/messages', [ChatController::class, 'messages'])->where(['conversation' => '[0-9]+']);
Route::post('chat/conversations/{conversation}/messages', [ChatController::class, 'send'])->where(['conversation' => '[0-9]+']);
Route::post('chat/conversations/{conversation}/read', [ChatController::class, 'read'])->where(['conversation' => '[0-9]+']);
// Cart items...
Route::get('carts', [CartController::class, 'index']);
Route::post('carts', [CartController::class, 'store']);