It is difficult for him to stay in Madeenah and leave his family and his mother far away; should he be patient or should he go back?
Question

                I came to al-Madeenah al-Munawwarah as a teacher of computer science three months ago and I left my family and my country. By Allah, I miss them and feel a great deal of distress because of being away from them. My mother also needs me and I am afraid that if I end my contract I will have gone against the command of the Messenger of Allah (blessings and peace of Allah be upon him) to be patient in bearing the hardships of Madeenah. What do you think, may Allah bless you?.
Praise be to Allah.
      There is nothing wrong with you ending your contract for 
      the reasons mentioned, and this does not have anything to do with not 
      being patient in putting up with the hardships of Madeenah, i.e., its heat 
      and difficulties, as mentioned in the hadeeth narrated by Muslim (1363) 
      from Sa‘d ibn Abi Waqqaas (may Allah be pleased with him) who said: The 
      Messenger of Allah (sa) said: “I declare sacred what is between the two 
      lava fields of Madeenah, (and I forbid) cutting of its thorny shrubs or 
      killing of its game.” And he said: “Madeenah is better for them, if only 
      they knew. No one leaves it out of dislike for it but Allaah will put 
      someone better than him in his place, and no one stands firm despite its 
      hardships and difficulties, but I will intercede for him, or be a witness 
      for him, on the Day of Resurrection.”. 

    And Muslim (1374) narrated from Abu Sa‘eed al-Mahri that he 
    came to Abu Sa‘eed al-Khudri (may Allah be pleased with him) and consulted 
    him about leaving Madeenah, complaining to him about its prices and his 
    large number of dependents, and telling him that he could not bear the 
    hardships and difficulties of Madeenah. He said to him: Woe to you! I do not 
    advise you to do that. I heard the Messenger of Allaah (S) say: “No one 
    bears its hardships with patience and dies, but I will intercede for him, or 
    I will be a witness for him, on the Day of Resurrection, if he is Muslim.” 

    Al-Nawawi (may Allah have mercy on him) said in Sharh 
    Muslim: Scholars of (Arabic) language said: al-la’waa (hardships) refers 
    to difficulty and hunger. … end quote. 

    If you leave Madeenah, it will not be because of the hardship 
    and difficulty encountered there; rather it will be to honour your mother 
    and keep yourself chaste. If you can combine the two things and bring your 
    wife and keep in frequent touch with your mother, then you will attain the 
    blessings of living in Madeenah and be included in this great promise of 
    attaining the intercession of the Prophet (blessings and peace of Allah be 
    upon him). Undoubtedly this will be better and more perfect. 

    We ask Allah to guide us and you. 

    And Allah knows best.