Zakariyya (as) was an abd (slave) of Allah. He was also a Prophet and he had no children for a very long time. When he realized that he was growing old and weak, he feared that there would be no one to take over from him in continuing his Dawah mission. At this point, he turned to Allah and made such a sincere and private heartfelt du’a for a child, that Allah preserved it in the Qur’an for all eternity.
The Prophet ﷺ said, “Whoever seeks the world, causes harm to the Hereafter, and whoever seeks the Hereafter, causes harm to (his) dunya, so lose the fleeting for the lasting! (i.e., prefer the lasting over the fleeting).” [al-Silsilah al-Sahihah]
“The pessimist complains about the wind; the optimist expects it to change; the
leader adjusts the sails.” - John Maxwell
The Messenger of Allah ﷺ said, “Wondrous is the affair of the believer for there is good for him in every matter and this is not the case with anyone except the believer. If he is happy, then he thanks Allah and thus there is good for him. If he is harmed, then he shows patience and thus there is good for him.” [Muslim]