diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index 74dab29..a4ba9d1 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -61,7 +61,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(); @@ -109,8 +109,8 @@ public function storeCapsule(Request $request, $chatId) { // Validation $request->validate([ - 'file' => 'required|file|mimes:jpeg,png,jpg,gif,mp3,mp4|max:1024', - '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 @@ -128,6 +128,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
- +