From 0009156483b9e9e93799b1242c81e99d0a25901b Mon Sep 17 00:00:00 2001 From: Naddeo Eddy Date: Thu, 12 Dec 2024 11:43:59 +0100 Subject: [PATCH] Adding .mov and reseting file input after sending it --- app/Http/Controllers/ChatController.php | 11 ++++++++--- .../views/components/messaging/chatbar.blade.php | 15 +++++++++++---- resources/views/dashboard.blade.php | 6 +++--- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index daf3436..f54aabe 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -60,7 +60,7 @@ public function index() public function getMessages($chatId) { $messages = Message::where('chat_id', $chatId) - ->orderBy('created_at', 'asc') + ->orderBy('opening_date', 'asc') ->with('user') ->get(); @@ -85,8 +85,8 @@ public function storeCapsule(Request $request, $chatId) { // Validation $request->validate([ - 'file' => 'required|file|mimes:jpeg,png,jpg,gif,mp3,mp4|max:1048576', - 'message' => 'required|string', + 'file' => 'required|file|mimes:jpeg,png,jpg,gif,mp3,mp4,mov|max:1048576', + 'message' => 'required|string' ]); // Vérification de la présence du fichier @@ -104,6 +104,11 @@ public function storeCapsule(Request $request, $chatId) $message->message = $request->message; $message->media_url = $mediaName; + // Vérifier que la date d'ouverture est définie + if ($request->has('date_time')) { + $message->opening_date = $request->date_time; + } + $message->save(); return response()->json(['message' => $message]); diff --git a/resources/views/components/messaging/chatbar.blade.php b/resources/views/components/messaging/chatbar.blade.php index c934e1a..3b64ccb 100644 --- a/resources/views/components/messaging/chatbar.blade.php +++ b/resources/views/components/messaging/chatbar.blade.php @@ -22,7 +22,7 @@ class="rounded-full secondary-background-app p-2 flex items-center justify-cente

cliquez pour sélectionner un fichier

- +