public function get_chat_message_by_user(Request $request) { if (isset($_COOKIE['doctor_user'])) { $doc = json_decode($_COOKIE['doctor_user'], true); $user_id = $doc[0]['id']; // Assign logged user`s id } else { if (isset($_COOKIE['user'])) { $user = json_decode($_COOKIE['user'], true); $user_id = $user[0]['id']; // Assign logged user`s id } } try { $chat_data = Chat_data::where('sender_id', '=', $user_id)->orwhere('receiver_id', '=', $user_id)->get(); $res['chat_data'] = $chat_data; } catch (Exception $e) { $this->LogError('AjaxController Get_Chat_Message_by_User Function', $e); } return response()->json($res); }
public function GetAdminChat(Request $request) { $userId = $request->user_id; try { $chat_data = Chat_data::where('sender_id', '=', $userId)->orwhere('receiver_id', '=', $userId)->get(); $res['chat_data'] = $chat_data; } catch (Exception $e) { $this->LogError('AjaxController Get_Chat_Message_by_User Function', $e); } return response()->json($res); }