From ab24f210a609c44a51190b2359563163bcb53713 Mon Sep 17 00:00:00 2001 From: Hank Date: Thu, 28 May 2026 03:59:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=B3=E6=99=82=E9=A0=90=E7=B4=84?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E5=AE=A4=EF=BC=88realtime=20booking=20chat?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 新增功能 - 會員與教練在 confirmed 預約期間可互傳文字與圖片訊息 - Presence Channel 顯示對方在線狀態(即時加入/離線) - 已讀回執:對方讀取訊息後即時更新 - 預約完成(completed)後訊息封存唯讀 - 圖片上傳使用 intervention/image 處理(移除 EXIF、限制尺寸、強制重新編碼) ## 通知系統 - 收到新訊息時 Bell Icon 即時更新(NotificationCreated via private channel) - 預約列表卡片顯示未讀角標(GET /api/bookings/messages/unread-counts 批次查詢) - 瀏覽器分頁在背景時推送 Web Notification ## 基礎建設 - 引入 Laravel Reverb 作為自架 WebSocket 伺服器 - docker-compose 新增 reverb service(連接 proxy_net,供 NPM 代理) - 前端安裝 laravel-echo + pusher-js,初始化 Echo plugin - Dockerfile 補 GD JPEG/WebP/FreeType 支援 ## 清理 - 移除 test_broadcast.php 與 resources/js/echo.js(Blade 殘留) - 移除 /ping、/testpost 測試路由 - channels.php 改用 class-based 授權語法,移除 debug log - BookingChat.vue otherType 提取為 computed 消除重複 - docker-entrypoint.sh 健康檢查改用 env var 取代硬編碼密碼 Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 6 +- app/Broadcasting/BookingPresenceChannel.php | 31 + app/Events/MessageRead.php | 40 + app/Events/MessageSent.php | 41 + app/Events/NotificationCreated.php | 32 + .../API/BookingMessageController.php | 185 +++ app/Models/Booking.php | 5 + app/Models/BookingMessage.php | 31 + .../NewBookingMessageNotification.php | 51 + bootstrap/app.php | 1 + composer.json | 2 + composer.lock | 1053 ++++++++++++++++- config/broadcasting.php | 82 ++ config/reverb.php | 102 ++ ...6_172438_create_booking_messages_table.php | 29 + docker-compose.yml | 39 + docker/php/docker-entrypoint.sh | 30 +- frontend/Dockerfile | 9 + frontend/package-lock.json | 230 ++++ frontend/package.json | 2 + frontend/src/components/BookingChat.vue | 274 +++++ .../src/composables/useBookingUnreadCounts.js | 39 + frontend/src/main.js | 2 + frontend/src/plugins/echo.js | 36 + frontend/src/stores/auth.js | 14 +- frontend/src/stores/coachAuth.js | 14 +- frontend/src/stores/notifications.js | 28 + frontend/src/views/MyBookingsView.vue | 25 + .../src/views/coach/BookingManagerView.vue | 111 +- .../realtime-booking-chat/.openspec.yaml | 2 + .../changes/realtime-booking-chat/design.md | 0 .../changes/realtime-booking-chat/proposal.md | 34 + .../specs/booking-chat/spec.md | 134 +++ .../specs/booking-lifecycle/spec.md | 24 + .../specs/user-presence/spec.md | 53 + .../changes/realtime-booking-chat/tasks.md | 78 ++ resources/js/bootstrap.js | 1 + routes/api.php | 24 +- routes/channels.php | 10 + 39 files changed, 2842 insertions(+), 62 deletions(-) create mode 100644 app/Broadcasting/BookingPresenceChannel.php create mode 100644 app/Events/MessageRead.php create mode 100644 app/Events/MessageSent.php create mode 100644 app/Events/NotificationCreated.php create mode 100644 app/Http/Controllers/API/BookingMessageController.php create mode 100644 app/Models/BookingMessage.php create mode 100644 app/Notifications/NewBookingMessageNotification.php create mode 100644 config/broadcasting.php create mode 100644 config/reverb.php create mode 100644 database/migrations/2026_05_26_172438_create_booking_messages_table.php create mode 100644 frontend/src/components/BookingChat.vue create mode 100644 frontend/src/composables/useBookingUnreadCounts.js create mode 100644 frontend/src/plugins/echo.js create mode 100644 openspec/changes/realtime-booking-chat/.openspec.yaml create mode 100644 openspec/changes/realtime-booking-chat/design.md create mode 100644 openspec/changes/realtime-booking-chat/proposal.md create mode 100644 openspec/changes/realtime-booking-chat/specs/booking-chat/spec.md create mode 100644 openspec/changes/realtime-booking-chat/specs/booking-lifecycle/spec.md create mode 100644 openspec/changes/realtime-booking-chat/specs/user-presence/spec.md create mode 100644 openspec/changes/realtime-booking-chat/tasks.md create mode 100644 routes/channels.php diff --git a/Dockerfile b/Dockerfile index 1cd5bc4..0aa3b32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,9 @@ RUN apt-get update && apt-get install -y \ git \ curl \ libpng-dev \ + libjpeg62-turbo-dev \ + libfreetype6-dev \ + libwebp-dev \ libonig-dev \ libxml2-dev \ zip \ @@ -21,7 +24,8 @@ RUN apt-get update && apt-get install -y \ RUN apt-get clean && rm -rf /var/lib/apt/lists/* # 安裝 PHP 擴展 -# 這些擴展是 Laravel 和一般 PHP 開發所需的 +# GD 需要在 install 前先 configure,才能帶入 jpeg/webp/freetype 支援 +RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip # 從官方 Composer 鏡像複製 Composer 執行文件 diff --git a/app/Broadcasting/BookingPresenceChannel.php b/app/Broadcasting/BookingPresenceChannel.php new file mode 100644 index 0000000..5238301 --- /dev/null +++ b/app/Broadcasting/BookingPresenceChannel.php @@ -0,0 +1,31 @@ +status->value !== 'confirmed') { + return false; + } + + $booking->loadMissing('schedule'); + + $isMember = $user->role === 'member' && $booking->member_id === $user->id; + $isProvider = $user->role === 'provider' && $booking->schedule->provider_id === $user->id; + + if (!$isMember && !$isProvider) { + return false; + } + + return [ + 'user_id' => $user->id, + 'user_type' => $user->role, + 'name' => $user->name, + ]; + } +} diff --git a/app/Events/MessageRead.php b/app/Events/MessageRead.php new file mode 100644 index 0000000..8b0c9a6 --- /dev/null +++ b/app/Events/MessageRead.php @@ -0,0 +1,40 @@ +bookingId), + ]; + } + + public function broadcastWith(): array + { + return [ + 'reader_type' => $this->readerType, + 'last_read_message_id' => $this->lastReadMessageId, + ]; + } +} diff --git a/app/Events/MessageSent.php b/app/Events/MessageSent.php new file mode 100644 index 0000000..058e3c7 --- /dev/null +++ b/app/Events/MessageSent.php @@ -0,0 +1,41 @@ +message->booking_id), + ]; + } + + public function broadcastWith(): array + { + return [ + 'id' => $this->message->id, + 'sender_id' => $this->message->sender_id, + 'sender_type' => $this->message->sender_type, + 'type' => $this->message->type, + 'content' => $this->message->content, + 'created_at' => $this->message->created_at->toISOString(), + ]; + } +} diff --git a/app/Events/NotificationCreated.php b/app/Events/NotificationCreated.php new file mode 100644 index 0000000..724e10e --- /dev/null +++ b/app/Events/NotificationCreated.php @@ -0,0 +1,32 @@ +userId}")]; + } + + public function broadcastAs(): string + { + return 'notification.created'; + } + + // 不需要 payload,前端收到後直接呼叫 fetchUnreadCount() + public function broadcastWith(): array + { + return []; + } +} diff --git a/app/Http/Controllers/API/BookingMessageController.php b/app/Http/Controllers/API/BookingMessageController.php new file mode 100644 index 0000000..f298d23 --- /dev/null +++ b/app/Http/Controllers/API/BookingMessageController.php @@ -0,0 +1,185 @@ +user(); + $booking->loadMissing('schedule'); + + if ($user->role === 'member') { + return $booking->member_id === $user->id; + } + + if ($user->role === 'provider') { + return $booking->schedule->provider_id === $user->id; + } + + return false; + } + + public function unreadCounts(Request $request): JsonResponse + { + $user = $request->user(); + $senderType = $user->role === 'member' ? 'member' : 'provider'; + $otherType = $senderType === 'member' ? 'provider' : 'member'; + + if ($senderType === 'member') { + $bookingIds = Booking::where('member_id', $user->id) + ->whereIn('status', ['confirmed', 'completed']) + ->pluck('id'); + } else { + $bookingIds = Booking::whereHas('schedule', fn($q) => $q->where('provider_id', $user->id)) + ->whereIn('status', ['confirmed', 'completed']) + ->pluck('id'); + } + + // 一次 query 取得所有 booking 的未讀數(只計對方發的、且 read_at 為 NULL) + $counts = BookingMessage::whereIn('booking_id', $bookingIds) + ->where('sender_type', $otherType) + ->whereNull('read_at') + ->selectRaw('booking_id, COUNT(*) as count') + ->groupBy('booking_id') + ->pluck('count', 'booking_id'); + + return response()->json(['status' => true, 'data' => $counts]); + } + + public function index(Request $request, Booking $booking): JsonResponse + { + if (!$this->authorizeParticipant($request, $booking)) { + return response()->json(['status' => false, 'message' => 'Forbidden'], 403); + } + + $status = $booking->status->value; + if (!in_array($status, ['confirmed', 'completed'])) { + return response()->json(['status' => false, 'message' => 'Forbidden'], 403); + } + + $messages = $booking->messages()->orderBy('created_at')->get(); + + return response()->json(['status' => true, 'data' => $messages]); + } + + public function store(Request $request, Booking $booking): JsonResponse + { + if (!$this->authorizeParticipant($request, $booking)) { + return response()->json(['status' => false, 'message' => 'Forbidden'], 403); + } + + if ($booking->status->value !== 'confirmed') { + return response()->json(['status' => false, 'message' => '訊息功能僅在預約確認期間開放'], 403); + } + + $request->validate(['type' => 'required|in:text,image']); + + $user = $request->user(); + $senderType = $user->role === 'member' ? 'member' : 'provider'; + + if ($request->input('type') === 'text') { + $request->validate(['content' => 'required|string|max:5000']); + + $message = BookingMessage::create([ + 'booking_id' => $booking->id, + 'sender_id' => $user->id, + 'sender_type' => $senderType, + 'type' => 'text', + 'content' => $request->input('content'), + ]); + } else { + $request->validate([ + 'file' => 'required|file|mimes:jpg,jpeg,png,gif,webp|max:10240', + ]); + + $manager = new ImageManager(new Driver()); + $image = $manager->read($request->file('file')); + + if ($image->width() > 2048 || $image->height() > 2048) { + $image->scaleDown(width: 2048, height: 2048); + } + + $uuid = Str::uuid(); + $filename = "booking-images/{$uuid}.jpg"; + $encoded = $image->toJpeg(quality: 85); + + Storage::disk('public')->put($filename, $encoded); + $url = Storage::disk('public')->url($filename); + + $message = BookingMessage::create([ + 'booking_id' => $booking->id, + 'sender_id' => $user->id, + 'sender_type' => $senderType, + 'type' => 'image', + 'content' => $url, + ]); + } + + broadcast(new MessageSent($message)); + + // 通知另一方(寫入 DB notification,讓 Bell 圖示更新) + $receiverId = $senderType === 'member' + ? $booking->schedule->provider_id + : $booking->member_id; + + $receiver = User::find($receiverId); + if ($receiver) { + // 同步寫進 DB(非 queue),確保下一行 broadcast 時 unread count 已是最新 + $receiver->notify(new NewBookingMessageNotification($message, $booking, $user)); + // 通知前端:立刻更新 bell badge,不等 polling + broadcast(new NotificationCreated($receiver->id)); + } + + return response()->json(['status' => true, 'data' => $message], 201); + } + + public function markRead(Request $request, Booking $booking): JsonResponse + { + if (!$this->authorizeParticipant($request, $booking)) { + return response()->json(['status' => false, 'message' => 'Forbidden'], 403); + } + + $status = $booking->status->value; + if (!in_array($status, ['confirmed', 'completed'])) { + return response()->json(['status' => false, 'message' => 'Forbidden'], 403); + } + + $request->validate(['last_read_message_id' => 'required|integer']); + + $user = $request->user(); + $senderType = $user->role === 'member' ? 'member' : 'provider'; + $otherType = $senderType === 'member' ? 'provider' : 'member'; + + $updated = BookingMessage::where('booking_id', $booking->id) + ->where('sender_type', $otherType) + ->where('id', '<=', $request->input('last_read_message_id')) + ->whereNull('read_at') + ->update(['read_at' => now()]); + + if ($updated > 0 && $status === 'confirmed') { + broadcast(new MessageRead( + $booking->id, + $senderType, + $request->input('last_read_message_id'), + )); + } + + return response()->json(['status' => true]); + } +} diff --git a/app/Models/Booking.php b/app/Models/Booking.php index f6644ed..ed663d0 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -48,4 +48,9 @@ class Booking extends Model { return $this->belongsTo(User::class, 'member_id'); } + + public function messages() + { + return $this->hasMany(BookingMessage::class); + } } diff --git a/app/Models/BookingMessage.php b/app/Models/BookingMessage.php new file mode 100644 index 0000000..bcd0c13 --- /dev/null +++ b/app/Models/BookingMessage.php @@ -0,0 +1,31 @@ + 'datetime', + ]; + + public function booking() + { + return $this->belongsTo(Booking::class); + } + + public function sender() + { + return $this->belongsTo(User::class, 'sender_id'); + } +} diff --git a/app/Notifications/NewBookingMessageNotification.php b/app/Notifications/NewBookingMessageNotification.php new file mode 100644 index 0000000..fbb032d --- /dev/null +++ b/app/Notifications/NewBookingMessageNotification.php @@ -0,0 +1,51 @@ +sender->role === 'provider' + ? "教練 {$this->sender->name}" + : $this->sender->name; + + $preview = $this->message->type === 'image' + ? '傳送了一張圖片' + : mb_strimwidth($this->message->content, 0, 50, '…'); + + // 依收件方角色決定跳轉路徑 + $actionUrl = $notifiable->role === 'provider' + ? config('app.frontend_url') . '/coach/bookings' + : config('app.frontend_url') . '/my-bookings'; + + return [ + 'type' => 'new_message', + 'title' => "{$senderLabel} 傳來新訊息", + 'body' => $preview, + 'action_url' => $actionUrl, + 'related_id' => $this->booking->id, + 'related_type' => 'booking', + ]; + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index a462725..e09d142 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -9,6 +9,7 @@ return Application::configure(basePath: dirname(__DIR__)) web: __DIR__.'/../routes/web.php', api: __DIR__.'/../routes/api.php', commands: __DIR__.'/../routes/console.php', + channels: __DIR__.'/../routes/channels.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware) { diff --git a/composer.json b/composer.json index 7b0fe8c..44cf817 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,9 @@ "require": { "php": "^8.2", "darkaonline/l5-swagger": "^9.0", + "intervention/image": "^3.11", "laravel/framework": "^11.0", + "laravel/reverb": "^1.10", "laravel/sanctum": "^4.1", "laravel/socialite": "^5.20", "laravel/tinker": "^2.9", diff --git a/composer.lock b/composer.lock index cbc94d4..c6f1e62 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c7d653b10f8ee748e5662242029651ce", + "content-hash": "1e04b3b51d8addcd4f3654d195453135", "packages": [ { "name": "brick/math", @@ -135,6 +135,136 @@ ], "time": "2024-02-09T16:56:22+00:00" }, + { + "name": "clue/redis-protocol", + "version": "v0.3.2", + "source": { + "type": "git", + "url": "https://github.com/clue/redis-protocol.git", + "reference": "6f565332f5531b7722d1e9c445314b91862f6d6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/redis-protocol/zipball/6f565332f5531b7722d1e9c445314b91862f6d6c", + "reference": "6f565332f5531b7722d1e9c445314b91862f6d6c", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\Redis\\Protocol\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@lueck.tv" + } + ], + "description": "A streaming Redis protocol (RESP) parser and serializer written in pure PHP.", + "homepage": "https://github.com/clue/redis-protocol", + "keywords": [ + "parser", + "protocol", + "redis", + "resp", + "serializer", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/redis-protocol/issues", + "source": "https://github.com/clue/redis-protocol/tree/v0.3.2" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2024-08-07T11:06:28+00:00" + }, + { + "name": "clue/redis-react", + "version": "v2.8.0", + "source": { + "type": "git", + "url": "https://github.com/clue/reactphp-redis.git", + "reference": "84569198dfd5564977d2ae6a32de4beb5a24bdca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/reactphp-redis/zipball/84569198dfd5564977d2ae6a32de4beb5a24bdca", + "reference": "84569198dfd5564977d2ae6a32de4beb5a24bdca", + "shasum": "" + }, + "require": { + "clue/redis-protocol": "^0.3.2", + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.0 || ^1.1", + "react/promise-timer": "^1.11", + "react/socket": "^1.16" + }, + "require-dev": { + "clue/block-react": "^1.5", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\React\\Redis\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Async Redis client implementation, built on top of ReactPHP.", + "homepage": "https://github.com/clue/reactphp-redis", + "keywords": [ + "async", + "client", + "database", + "reactphp", + "redis" + ], + "support": { + "issues": "https://github.com/clue/reactphp-redis/issues", + "source": "https://github.com/clue/reactphp-redis/tree/v2.8.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2025-01-03T16:18:33+00:00" + }, { "name": "darkaonline/l5-swagger", "version": "9.0.1", @@ -667,6 +797,53 @@ ], "time": "2025-03-06T22:45:56+00:00" }, + { + "name": "evenement/evenement", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Evenement\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" + }, { "name": "firebase/php-jwt", "version": "v6.11.1", @@ -1274,6 +1451,150 @@ ], "time": "2025-02-03T10:55:03+00:00" }, + { + "name": "intervention/gif", + "version": "4.2.4", + "source": { + "type": "git", + "url": "https://github.com/Intervention/gif.git", + "reference": "c3598a16ebe7690cd55640c44144a9df383ea73c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/gif/zipball/c3598a16ebe7690cd55640c44144a9df383ea73c", + "reference": "c3598a16ebe7690cd55640c44144a9df383ea73c", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "slevomat/coding-standard": "~8.0", + "squizlabs/php_codesniffer": "^3.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Intervention\\Gif\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io/" + } + ], + "description": "Native PHP GIF Encoder/Decoder", + "homepage": "https://github.com/intervention/gif", + "keywords": [ + "animation", + "gd", + "gif", + "image" + ], + "support": { + "issues": "https://github.com/Intervention/gif/issues", + "source": "https://github.com/Intervention/gif/tree/4.2.4" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + }, + { + "url": "https://ko-fi.com/interventionphp", + "type": "ko_fi" + } + ], + "time": "2026-01-04T09:27:23+00:00" + }, + { + "name": "intervention/image", + "version": "3.11.8", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "cf04c8dd245697f701057c13d4bfe140d584e738" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/cf04c8dd245697f701057c13d4bfe140d584e738", + "reference": "cf04c8dd245697f701057c13d4bfe140d584e738", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "intervention/gif": "^4.2", + "php": "^8.1" + }, + "require-dev": { + "mockery/mockery": "^1.6", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "slevomat/coding-standard": "~8.0", + "squizlabs/php_codesniffer": "^4" + }, + "suggest": { + "ext-exif": "Recommended to be able to read EXIF data properly." + }, + "type": "library", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io" + } + ], + "description": "PHP Image Processing", + "homepage": "https://image.intervention.io", + "keywords": [ + "gd", + "image", + "imagick", + "resize", + "thumbnail", + "watermark" + ], + "support": { + "issues": "https://github.com/Intervention/image/issues", + "source": "https://github.com/Intervention/image/tree/3.11.8" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + }, + { + "url": "https://ko-fi.com/interventionphp", + "type": "ko_fi" + } + ], + "time": "2026-05-01T08:20:10+00:00" + }, { "name": "laravel/framework", "version": "v11.44.7", @@ -1548,6 +1869,85 @@ }, "time": "2025-02-11T13:34:40+00:00" }, + { + "name": "laravel/reverb", + "version": "v1.10.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/reverb.git", + "reference": "43a5c0a99b1aaba33dc32f97fcf51f182dd8c8ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/reverb/zipball/43a5c0a99b1aaba33dc32f97fcf51f182dd8c8ac", + "reference": "43a5c0a99b1aaba33dc32f97fcf51f182dd8c8ac", + "shasum": "" + }, + "require": { + "clue/redis-react": "^2.6", + "guzzlehttp/psr7": "^2.6", + "illuminate/console": "^10.47|^11.0|^12.0|^13.0", + "illuminate/contracts": "^10.47|^11.0|^12.0|^13.0", + "illuminate/http": "^10.47|^11.0|^12.0|^13.0", + "illuminate/support": "^10.47|^11.0|^12.0|^13.0", + "laravel/prompts": "^0.1.15|^0.2.0|^0.3.0", + "php": "^8.2", + "pusher/pusher-php-server": "^7.2", + "ratchet/rfc6455": "^0.4", + "react/promise-timer": "^1.10", + "react/socket": "^1.14", + "symfony/console": "^6.0|^7.0|^8.0", + "symfony/http-foundation": "^6.3|^7.0|^8.0" + }, + "require-dev": { + "orchestra/testbench": "^8.36|^9.15|^10.8|^11.0", + "pestphp/pest": "^2.0|^3.0|^4.0", + "phpstan/phpstan": "^1.10", + "ratchet/pawl": "^0.4.1", + "react/async": "^4.2", + "react/http": "^1.9" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laravel\\Reverb\\ApplicationManagerServiceProvider", + "Laravel\\Reverb\\ReverbServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Reverb\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + }, + { + "name": "Joe Dixon", + "email": "joe@laravel.com" + } + ], + "description": "Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.", + "keywords": [ + "WebSockets", + "laravel", + "real-time", + "websocket" + ], + "support": { + "issues": "https://github.com/laravel/reverb/issues", + "source": "https://github.com/laravel/reverb/tree/v1.10.2" + }, + "time": "2026-05-10T15:47:52+00:00" + }, { "name": "laravel/sanctum", "version": "v4.1.1", @@ -3845,6 +4245,66 @@ }, "time": "2025-03-16T03:05:19+00:00" }, + { + "name": "pusher/pusher-php-server", + "version": "7.2.8", + "source": { + "type": "git", + "url": "https://github.com/pusher/pusher-http-php.git", + "reference": "4aa139ed2a2a805cd265449b691198beee1309d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pusher/pusher-http-php/zipball/4aa139ed2a2a805cd265449b691198beee1309d2", + "reference": "4aa139ed2a2a805cd265449b691198beee1309d2", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "guzzlehttp/guzzle": "^7.2", + "php": "^7.3|^8.0", + "psr/log": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "overtrue/phplint": "^2.3", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Pusher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Library for interacting with the Pusher REST API", + "keywords": [ + "events", + "messaging", + "php-pusher-server", + "publish", + "push", + "pusher", + "real time", + "real-time", + "realtime", + "rest", + "trigger" + ], + "support": { + "issues": "https://github.com/pusher/pusher-http-php/issues", + "source": "https://github.com/pusher/pusher-http-php/tree/7.2.8" + }, + "time": "2026-05-18T13:11:36+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", @@ -4057,6 +4517,595 @@ ], "time": "2024-04-27T21:32:50+00:00" }, + { + "name": "ratchet/rfc6455", + "version": "v0.4.0", + "source": { + "type": "git", + "url": "https://github.com/ratchetphp/RFC6455.git", + "reference": "859d95f85dda0912c6d5b936d036d044e3af47ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/859d95f85dda0912c6d5b936d036d044e3af47ef", + "reference": "859d95f85dda0912c6d5b936d036d044e3af47ef", + "shasum": "" + }, + "require": { + "php": ">=7.4", + "psr/http-factory-implementation": "^1.0", + "symfony/polyfill-php80": "^1.15" + }, + "require-dev": { + "guzzlehttp/psr7": "^2.7", + "phpunit/phpunit": "^9.5", + "react/socket": "^1.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ratchet\\RFC6455\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "role": "Developer" + }, + { + "name": "Matt Bonneau", + "role": "Developer" + } + ], + "description": "RFC6455 WebSocket protocol handler", + "homepage": "http://socketo.me", + "keywords": [ + "WebSockets", + "rfc6455", + "websocket" + ], + "support": { + "chat": "https://gitter.im/reactphp/reactphp", + "issues": "https://github.com/ratchetphp/RFC6455/issues", + "source": "https://github.com/ratchetphp/RFC6455/tree/v0.4.0" + }, + "time": "2025-02-24T01:18:22+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/dns", + "version": "v1.14.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "7562c05391f42701c1fccf189c8225fece1cd7c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/7562c05391f42701c1fccf189c8225fece1cd7c3", + "reference": "7562c05391f42701c1fccf189c8225fece1cd7c3", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.14.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-11-18T19:34:28+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/ba276bda6083df7e0050fd9b33f66ad7a4ac747a", + "reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.6.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-11-17T20:46:25+00:00" + }, + { + "name": "react/promise", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/23444f53a813a3296c1368bb104793ce8d88f04a", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.28 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-08-19T18:57:03+00:00" + }, + { + "name": "react/promise-timer", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise-timer.git", + "reference": "4f70306ed66b8b44768941ca7f142092600fafc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise-timer/zipball/4f70306ed66b8b44768941ca7f142092600fafc1", + "reference": "4f70306ed66b8b44768941ca7f142092600fafc1", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7.0 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\Timer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A trivial implementation of timeouts for Promises, built on top of ReactPHP.", + "homepage": "https://github.com/reactphp/promise-timer", + "keywords": [ + "async", + "event-loop", + "promise", + "reactphp", + "timeout", + "timer" + ], + "support": { + "issues": "https://github.com/reactphp/promise-timer/issues", + "source": "https://github.com/reactphp/promise-timer/tree/v1.11.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-04T14:27:45+00:00" + }, + { + "name": "react/socket", + "version": "v1.17.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/ef5b17b81f6f60504c539313f94f2d826c5faa08", + "reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.17.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-11-19T20:47:34+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, { "name": "swagger-api/swagger-ui", "version": "v5.21.0", @@ -9236,5 +10285,5 @@ "php": "^8.2" }, "platform-dev": {}, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/config/broadcasting.php b/config/broadcasting.php new file mode 100644 index 0000000..ebc3fb9 --- /dev/null +++ b/config/broadcasting.php @@ -0,0 +1,82 @@ + env('BROADCAST_CONNECTION', 'null'), + + /* + |-------------------------------------------------------------------------- + | Broadcast Connections + |-------------------------------------------------------------------------- + | + | Here you may define all of the broadcast connections that will be used + | to broadcast events to other systems or over WebSockets. Samples of + | each available type of connection are provided inside this array. + | + */ + + 'connections' => [ + + 'reverb' => [ + 'driver' => 'reverb', + 'key' => env('REVERB_APP_KEY'), + 'secret' => env('REVERB_APP_SECRET'), + 'app_id' => env('REVERB_APP_ID'), + 'options' => [ + 'host' => env('REVERB_HOST'), + 'port' => env('REVERB_PORT', 443), + 'scheme' => env('REVERB_SCHEME', 'https'), + 'useTLS' => env('REVERB_SCHEME', 'https') === 'https', + ], + 'client_options' => [ + // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html + ], + ], + + 'pusher' => [ + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), + 'options' => [ + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', + 'port' => env('PUSHER_PORT', 443), + 'scheme' => env('PUSHER_SCHEME', 'https'), + 'encrypted' => true, + 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', + ], + 'client_options' => [ + // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html + ], + ], + + 'ably' => [ + 'driver' => 'ably', + 'key' => env('ABLY_KEY'), + ], + + 'log' => [ + 'driver' => 'log', + ], + + 'null' => [ + 'driver' => 'null', + ], + + ], + +]; diff --git a/config/reverb.php b/config/reverb.php new file mode 100644 index 0000000..7b37ac6 --- /dev/null +++ b/config/reverb.php @@ -0,0 +1,102 @@ + env('REVERB_SERVER', 'reverb'), + + /* + |-------------------------------------------------------------------------- + | Reverb Servers + |-------------------------------------------------------------------------- + | + | Here you may define details for each of the supported Reverb servers. + | Each server has its own configuration options that are defined in + | the array below. You should ensure all the options are present. + | + */ + + 'servers' => [ + + 'reverb' => [ + 'host' => env('REVERB_SERVER_HOST', '0.0.0.0'), + 'port' => env('REVERB_SERVER_PORT', 8080), + 'path' => env('REVERB_SERVER_PATH', ''), + 'hostname' => env('REVERB_SERVER_HOSTNAME', null), + 'options' => [ + 'tls' => [], + ], + 'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000), + 'scaling' => [ + 'enabled' => env('REVERB_SCALING_ENABLED', false), + 'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'), + 'server' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'port' => env('REDIS_PORT', '6379'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'database' => env('REDIS_DB', '0'), + 'timeout' => env('REDIS_TIMEOUT', 60), + ], + ], + 'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15), + 'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15), + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Reverb Applications + |-------------------------------------------------------------------------- + | + | Here you may define how Reverb applications are managed. If you choose + | to use the "config" provider, you may define an array of apps which + | your server will support, including their connection credentials. + | + */ + + 'apps' => [ + + 'provider' => 'config', + + 'apps' => [ + [ + 'key' => env('REVERB_APP_KEY'), + 'secret' => env('REVERB_APP_SECRET'), + 'app_id' => env('REVERB_APP_ID'), + 'options' => [ + 'host' => env('REVERB_HOST'), + 'port' => env('REVERB_PORT', 443), + 'scheme' => env('REVERB_SCHEME', 'https'), + 'useTLS' => env('REVERB_SCHEME', 'https') === 'https', + ], + 'allowed_origins' => ['*'], + 'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60), + 'activity_timeout' => env('REVERB_APP_ACTIVITY_TIMEOUT', 30), + 'max_connections' => env('REVERB_APP_MAX_CONNECTIONS'), + 'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000), + 'accept_client_events_from' => env('REVERB_APP_ACCEPT_CLIENT_EVENTS_FROM', 'members'), + 'rate_limiting' => [ + 'enabled' => env('REVERB_APP_RATE_LIMITING_ENABLED', false), + 'max_attempts' => env('REVERB_APP_RATE_LIMIT_MAX_ATTEMPTS', 60), + 'decay_seconds' => env('REVERB_APP_RATE_LIMIT_DECAY_SECONDS', 60), + 'terminate_on_limit' => env('REVERB_APP_RATE_LIMIT_TERMINATE', false), + ], + ], + ], + + ], + +]; diff --git a/database/migrations/2026_05_26_172438_create_booking_messages_table.php b/database/migrations/2026_05_26_172438_create_booking_messages_table.php new file mode 100644 index 0000000..d516363 --- /dev/null +++ b/database/migrations/2026_05_26_172438_create_booking_messages_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId("booking_id")->constrained("bookings")->cascadeOnDelete(); + $table->foreignId("sender_id")->constrained("users")->cascadeOnDelete(); + $table->enum("sender_type", ["member", "provider"]); + $table->enum("type", ["text", "image"]); + $table->text("content"); + $table->timestamp("read_at")->nullable(); + $table->timestamps(); + + $table->index(["booking_id", "created_at"]); + }); + } + + public function down(): void + { + Schema::dropIfExists("booking_messages"); + } +}; diff --git a/docker-compose.yml b/docker-compose.yml index 185bf04..2efed2a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,6 +48,8 @@ services: image: nginx:alpine container_name: cfdive-nginx restart: unless-stopped + ports: + - "127.0.0.1:8080:80" volumes: - ./:/var/www - ./docker/nginx/conf.d/:/etc/nginx/conf.d/ @@ -69,9 +71,15 @@ services: dockerfile: Dockerfile args: VITE_API_URL: ${VITE_API_URL:-https://api.hank-spack.com} + VITE_REVERB_APP_KEY: ${VITE_REVERB_APP_KEY} + VITE_REVERB_HOST: ${VITE_REVERB_HOST:-localhost} + VITE_REVERB_PORT: ${VITE_REVERB_PORT:-8085} + VITE_REVERB_SCHEME: ${VITE_REVERB_SCHEME:-http} image: cfdive-frontend container_name: cfdive-frontend restart: unless-stopped + ports: + - "127.0.0.1:5173:80" networks: - cfdive-network - proxy_net @@ -156,6 +164,37 @@ services: timeout: 10s retries: 3 + reverb: + image: cfdive-platform + container_name: cfdive-reverb + restart: unless-stopped + working_dir: /var/www/ + entrypoint: ["php", "artisan", "reverb:start", "--host=0.0.0.0", "--port=8080"] + ports: + - "127.0.0.1:8085:8080" + volumes: + - ./:/var/www + environment: + - APP_KEY=${APP_KEY} + - REVERB_APP_ID=${REVERB_APP_ID} + - REVERB_APP_KEY=${REVERB_APP_KEY} + - REVERB_APP_SECRET=${REVERB_APP_SECRET} + - REVERB_HOST=reverb + - REVERB_PORT=8080 + - REDIS_HOST=redis + - DB_CONNECTION=mysql + - DB_HOST=db + - DB_PORT=3306 + - DB_DATABASE=${DB_DATABASE:-CFDivePlatform} + - DB_USERNAME=${DB_USERNAME:-cfdiveuser} + - DB_PASSWORD=${DB_PASSWORD} + networks: + - cfdive-network + - proxy_net + depends_on: + app: + condition: service_healthy + networks: cfdive-network: driver: bridge diff --git a/docker/php/docker-entrypoint.sh b/docker/php/docker-entrypoint.sh index 1aede9d..21c2b53 100644 --- a/docker/php/docker-entrypoint.sh +++ b/docker/php/docker-entrypoint.sh @@ -28,7 +28,7 @@ COUNT=0 wait_for_mysql() { while [ $COUNT -lt $MAX_TRIES ]; do - if mysqladmin ping -h"db" -u"cfdiveuser" -p"**REMOVED**" --silent 2>/dev/null; then + if mysqladmin ping -h"db" -u"${DB_USERNAME:-cfdiveuser}" -p"${DB_PASSWORD}" --silent 2>/dev/null; then echo "✅ MySQL 服務已準備就緒" return 0 fi @@ -36,7 +36,7 @@ wait_for_mysql() { # 備用檢查方法 if php -r " try { - \$pdo = new PDO('mysql:host=db;port=3306', 'cfdiveuser', '**REMOVED**'); + \$pdo = new PDO('mysql:host=db;port=3306', getenv('DB_USERNAME') ?: 'cfdiveuser', getenv('DB_PASSWORD') ?: ''); echo 'PHP-PDO-OK'; exit(0); } catch(Exception \$e) { @@ -80,12 +80,28 @@ else echo "✅ .env 檔案已存在" fi -# 更新環境變數以確保正確配置 +# 更新環境變數以確保正確配置(用 PHP 安全處理含特殊字元的密碼) echo "🔧 更新資料庫配置..." -sed -i "s/DB_HOST=.*/DB_HOST=db/g" .env -sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=**REMOVED**/g" .env -sed -i "s/DB_USERNAME=.*/DB_USERNAME=cfdiveuser/g" .env -sed -i "s/DB_DATABASE=.*/DB_DATABASE=CFDivePlatform/g" .env +cat > /tmp/update_env.php << 'PHPEOF' + 'db', + 'DB_USERNAME' => (getenv('DB_USERNAME') ?: 'cfdiveuser'), + 'DB_DATABASE' => (getenv('DB_DATABASE') ?: 'CFDivePlatform'), + 'DB_PASSWORD' => (getenv('DB_PASSWORD') ?: ''), +]; +foreach ($map as $key => $val) { + $env = preg_replace_callback( + '/^' . preg_quote($key, '/') . '=.*$/m', + function() use ($key, $val) { return $key . '=' . $val; }, + $env + ); +} +file_put_contents('/var/www/.env', $env); +echo "✅ DB config updated\n"; +PHPEOF +php /tmp/update_env.php # 執行遷移(如果數據庫已準備好) echo "🗄️ 執行數據庫遷移..." diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 141eaa0..b374468 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -8,7 +8,16 @@ RUN npm install COPY . . ARG VITE_API_URL=http://localhost:8080 +ARG VITE_REVERB_APP_KEY +ARG VITE_REVERB_HOST=localhost +ARG VITE_REVERB_PORT=8085 +ARG VITE_REVERB_SCHEME=http + ENV VITE_API_URL=$VITE_API_URL +ENV VITE_REVERB_APP_KEY=$VITE_REVERB_APP_KEY +ENV VITE_REVERB_HOST=$VITE_REVERB_HOST +ENV VITE_REVERB_PORT=$VITE_REVERB_PORT +ENV VITE_REVERB_SCHEME=$VITE_REVERB_SCHEME RUN npm run build diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 50da860..3318f68 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,7 +9,9 @@ "version": "0.0.0", "dependencies": { "axios": "^1.16.0", + "laravel-echo": "^2.3.4", "pinia": "^3.0.4", + "pusher-js": "^8.5.0", "vue": "^3.5.32", "vue-router": "^4.6.4" }, @@ -450,6 +452,12 @@ "integrity": "sha512-3ngTAv6F/Py35BsYbeeLeecvhMKdsKm4AoOETVhAA+Qc8nrA2I0kF7oa93mE9qnIurngOSpMnQ0x2nQY2FPviA==", "dev": true }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", + "peer": true + }, "node_modules/@tybys/wasm-util": { "version": "0.10.2", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz", @@ -890,6 +898,23 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==" }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "peer": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -938,6 +963,28 @@ "integrity": "sha512-kOrWphBi8TOZyiJZqsgqIle0lw+tzmnQK83pV9dZUd01Nm2POECSyFQMAuarzZdYqQW7FH9RaYOuaRo3h+bQ3w==", "dev": true }, + "node_modules/engine.io-client": { + "version": "6.6.5", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.5.tgz", + "integrity": "sha512-QCwxUDULPlXv8F6tqMMKx5dNkTe6OaBYRMPYeXKBlyOoKvAmE0ac6pW7fFhSscJ/5SI7666/U/B+MElbsrJlIg==", + "peer": true, + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.20.1", + "xmlhttprequest-ssl": "~2.1.1" + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "peer": true, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/entities": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", @@ -1315,6 +1362,18 @@ "jiti": "bin/jiti.js" } }, + "node_modules/laravel-echo": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/laravel-echo/-/laravel-echo-2.3.4.tgz", + "integrity": "sha512-rpALCIK1uw2SrttcK9P5JzItt5I85RcfXQKUNnkcorzhtKeXi5GS0PVFFBH8ppNo8wnbdBKuD1EtIHgTbXo9FQ==", + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "pusher-js": "*", + "socket.io-client": "*" + } + }, "node_modules/lightningcss": { "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", @@ -1656,6 +1715,12 @@ "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "peer": true + }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -1946,6 +2011,14 @@ "node": ">=10" } }, + "node_modules/pusher-js": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/pusher-js/-/pusher-js-8.5.0.tgz", + "integrity": "sha512-V7uzGi9bqOOOyM/6IkJdpFyjGZj7llz1v0oWnYkZKcYLvbz6VcHVLmzKqkvegjuMumpfIEKGLmWHwFb39XFCpw==", + "dependencies": { + "tweetnacl": "^1.0.3" + } + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -2097,6 +2170,34 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/socket.io-client": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.3.tgz", + "integrity": "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g==", + "peer": true, + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1", + "engine.io-client": "~6.6.1", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.6.tgz", + "integrity": "sha512-asJqbVBDsBCJx0pTqw3WfesSY0iRX+2xzWEWzrpcH7L6fLzrhyF8WPI8UaeM4YCuDfpwA/cgsdugMsmtz8EJeg==", + "peer": true, + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -2257,6 +2358,11 @@ "dev": true, "optional": true }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", @@ -2408,6 +2514,36 @@ "version": "6.6.4", "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.4.tgz", "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==" + }, + "node_modules/ws": { + "version": "8.20.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.20.1.tgz", + "integrity": "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w==", + "peer": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xmlhttprequest-ssl": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz", + "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==", + "peer": true, + "engines": { + "node": ">=0.4.0" + } } }, "dependencies": { @@ -2664,6 +2800,12 @@ "integrity": "sha512-3ngTAv6F/Py35BsYbeeLeecvhMKdsKm4AoOETVhAA+Qc8nrA2I0kF7oa93mE9qnIurngOSpMnQ0x2nQY2FPviA==", "dev": true }, + "@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", + "peer": true + }, "@tybys/wasm-util": { "version": "0.10.2", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz", @@ -2979,6 +3121,15 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==" }, + "debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "peer": true, + "requires": { + "ms": "^2.1.3" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -3018,6 +3169,25 @@ "integrity": "sha512-kOrWphBi8TOZyiJZqsgqIle0lw+tzmnQK83pV9dZUd01Nm2POECSyFQMAuarzZdYqQW7FH9RaYOuaRo3h+bQ3w==", "dev": true }, + "engine.io-client": { + "version": "6.6.5", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.5.tgz", + "integrity": "sha512-QCwxUDULPlXv8F6tqMMKx5dNkTe6OaBYRMPYeXKBlyOoKvAmE0ac6pW7fFhSscJ/5SI7666/U/B+MElbsrJlIg==", + "peer": true, + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.20.1", + "xmlhttprequest-ssl": "~2.1.1" + } + }, + "engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "peer": true + }, "entities": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", @@ -3263,6 +3433,12 @@ "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "dev": true }, + "laravel-echo": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/laravel-echo/-/laravel-echo-2.3.4.tgz", + "integrity": "sha512-rpALCIK1uw2SrttcK9P5JzItt5I85RcfXQKUNnkcorzhtKeXi5GS0PVFFBH8ppNo8wnbdBKuD1EtIHgTbXo9FQ==", + "requires": {} + }, "lightningcss": { "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", @@ -3427,6 +3603,12 @@ "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "peer": true + }, "mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -3578,6 +3760,14 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==" }, + "pusher-js": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/pusher-js/-/pusher-js-8.5.0.tgz", + "integrity": "sha512-V7uzGi9bqOOOyM/6IkJdpFyjGZj7llz1v0oWnYkZKcYLvbz6VcHVLmzKqkvegjuMumpfIEKGLmWHwFb39XFCpw==", + "requires": { + "tweetnacl": "^1.0.3" + } + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -3675,6 +3865,28 @@ "queue-microtask": "^1.2.2" } }, + "socket.io-client": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.3.tgz", + "integrity": "sha512-uP0bpjWrjQmUt5DTHq9RuoCBdFJF10cdX9X+a368j/Ft0wmaVgxlrjvK3kjvgCODOMMOz9lcaRzxmso0bTWZ/g==", + "peer": true, + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1", + "engine.io-client": "~6.6.1", + "socket.io-parser": "~4.2.4" + } + }, + "socket.io-parser": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.6.tgz", + "integrity": "sha512-asJqbVBDsBCJx0pTqw3WfesSY0iRX+2xzWEWzrpcH7L6fLzrhyF8WPI8UaeM4YCuDfpwA/cgsdugMsmtz8EJeg==", + "peer": true, + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.4.1" + } + }, "source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -3794,6 +4006,11 @@ "dev": true, "optional": true }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, "update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", @@ -3850,6 +4067,19 @@ "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==" } } + }, + "ws": { + "version": "8.20.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.20.1.tgz", + "integrity": "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w==", + "peer": true, + "requires": {} + }, + "xmlhttprequest-ssl": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz", + "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==", + "peer": true } } } diff --git a/frontend/package.json b/frontend/package.json index 70c3d6a..c7646fb 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,7 +10,9 @@ }, "dependencies": { "axios": "^1.16.0", + "laravel-echo": "^2.3.4", "pinia": "^3.0.4", + "pusher-js": "^8.5.0", "vue": "^3.5.32", "vue-router": "^4.6.4" }, diff --git a/frontend/src/components/BookingChat.vue b/frontend/src/components/BookingChat.vue new file mode 100644 index 0000000..f6b6437 --- /dev/null +++ b/frontend/src/components/BookingChat.vue @@ -0,0 +1,274 @@ + + +