munafio / chatify-demo

Chatify Laravel Package Demo application
https://github.com/munafio/chatify
489 stars 179 forks source link

changing user profile from avatar #55

Closed daniel-teddy closed 1 year ago

daniel-teddy commented 1 year ago

I was wondering having a database where each user has a profile_picture, I want to use it as the avatar specified in chatify, anyone can hepl me achieve this ? I see that its being set with javascript after making a request with ajax `$.ajax({ url: url + "/idInfo", method: "POST", data: { _token: csrfToken, id }, dataType: "JSON",

  success: (data) => {
    if (!data?.fetch) {
      NProgress.done();
      NProgress.remove();
      return;
    }
    // avatar photo
    $(".messenger-infoView")
      .find(".avatar")
      .css("background-image", 'url("' + data.user_avatar + '")');
      console.log("data"),
    $(".header-avatar").css(
      "background-image",
      'url("' + data.user_avatar + '")'
    );`
munafio commented 1 year ago

@teddy-webdev simply you can modify idFetchData method's response to return your specified avatar instead of what Chatify does. The method available at MessagesController of Chatify, you need to publish the controller to be able to modify. Read the official documentation