diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php
index a4ba9d1..8e6bcf3 100644
--- a/app/Http/Controllers/ChatController.php
+++ b/app/Http/Controllers/ChatController.php
@@ -164,4 +164,17 @@ public function storeChat(Request $request)
// Rediriger avec un message de succès
return redirect()->route('dashboard')->with('success', 'Discussion créée avec succès !');
}
+
+ public function leaveChat($chatId)
+ {
+ $chat = Chat::find($chatId);
+
+ if (!$chat) {
+ return response()->json(['error' => 'Chat not found.'], 404);
+ }
+
+ $chat->users()->detach(auth()->id());
+
+ return response()->json(['message' => 'You left the chat.']);
+ }
}
diff --git a/public/source/media/1734181073_yealink_mp54-e2-teams_f_423320.jpg b/public/source/media/1734181073_yealink_mp54-e2-teams_f_423320.jpg
new file mode 100644
index 0000000..ecde65e
Binary files /dev/null and b/public/source/media/1734181073_yealink_mp54-e2-teams_f_423320.jpg differ
diff --git a/resources/views/components/messaging/header.blade.php b/resources/views/components/messaging/header.blade.php
index e2569e2..585f4a8 100644
--- a/resources/views/components/messaging/header.blade.php
+++ b/resources/views/components/messaging/header.blade.php
@@ -1,4 +1,11 @@
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php
index 1343706..99ade0c 100644
--- a/resources/views/dashboard.blade.php
+++ b/resources/views/dashboard.blade.php
@@ -1,16 +1,17 @@
+
+
+
-
-
+
-
@@ -20,17 +21,15 @@
let currentChatId = null;
let interval = null;
let allMessages = [];
- const currentUserId = {{ auth()->id() }};
+ // Fonction pour charger la discussion
function loadChat(chatId, discussionName, discussionPicture, newOpening = true) {
- const messagesContainer = document.getElementById('messages');
+ const messagesContainer = document.getElementById('messages');
- document.getElementById('chat-placeholder').style.display = 'none';
- document.getElementById('chat-area').style.display = 'flex';
+ // Masquer le placeholder et afficher la zone de chat
+ document.getElementById('chat-placeholder').style.display = 'none';
+ document.getElementById('chat-area').style.display = 'flex';
- if (currentChatId !== chatId) {
- allMessages = [];
- messagesContainer.innerHTML = '';
// Vérifier si la discussion est déjà chargée
if (currentChatId !== chatId) {
// Réinitialiser la liste de tout les messages
@@ -51,7 +50,7 @@ function loadChat(chatId, discussionName, discussionPicture, newOpening = true)
if (headerTitle) headerTitle.textContent = discussionName;
const headerImage = document.querySelector('.headerImage');
- if(headerImage) headerImage.src = discussionPicture;
+ if (headerImage) headerImage.src = discussionPicture;
}
fetch(`/chat/${chatId}/messages`, {
@@ -109,7 +108,7 @@ function loadChat(chatId, discussionName, discussionPicture, newOpening = true)