Tafsir Ibn Kathir -> Surah At-Taghabun -> All that occurs to Mankind is by Allah's Permission

Allah informs us as He did in Surat Al-Hadid,

﴿مَآ أَصَابَ مِن مُّصِيبَةٍ فِى الاٌّرْضِ وَلاَ فِى أَنفُسِكُمْ إِلاَّ فِى كِتَـبٍ مِّن قَبْلِ أَن نَّبْرَأَهَآ إِنَّ ذَلِكَ عَلَى اللَّهِ يَسِيرٌ ﴾

(No calamity occurs on the earth or in yourselves but it is inscribed in a record before We bring it into existence. Verily, that is easy for Allah.) (57:22) Allah said here,

﴿مَآ أَصَابَ مِن مُّصِيبَةٍ إِلاَّ بِإِذْنِ اللَّهِ﴾

(No calamity occurs, but by the permission of Allah,) Ibn `Abbas said; "By the command of Allah,'' meaning from His decree and will.

﴿وَمَن يُؤْمِن بِاللَّهِ يَهْدِ قَلْبَهُ وَاللَّهُ بِكُلِّ شَىْءٍ عَلِيمٌ﴾

(and whosoever believes in Allah, He guides his heart. And Allah is the All-Knower of everything.) meaning, whoever suffered an affliction and he knew that it occurred by Allah's judgement and decree, and he patiently abides, awaiting Allah's reward, then Allah guides his heart, and will compensate him for his loss in this life by granting guidance to his heart and certainty in faith. Allah will replace whatever he lost for Him with the same or what is better. `Ali bin Abi Talhah reported from Ibn `Abbas,

﴿وَمَن يُؤْمِن بِاللَّهِ يَهْدِ قَلْبَهُ﴾

(and whosoever believes in Allah, He guides his heart.) "Allah will guide his heart to certainty. Therefore, he will know that what reached him would not have missed him and what has missed him would not have reached him.'' There is an agreed upon Hadith ﴿that Al-Bukhari and Muslim collected and﴾ which states,

«عَجَبًا لِلْمُؤْمِنِ لَا يَقْضِي اللهُ لَهُ قَضَاءً إِلَّا كَانَ خَيْرًا لَهُ، إِنْ أَصَابَتْهُ ضَرَّاءُ صَبَرَ فَكَانَ خَيْرًا لَهُ، وَإِنْ أَصَابَتْهُ سَرَّاءُ شَكَرَ فَكَانَ خَيْرًا لَهُ، وَلَيْسَ ذَلِكَ لِأَحَدٍ إِلَّا لِلْمُؤْمِن»

(Amazing is the believer: There is no decree that Allah writes for him, but is better for him. If an affliction strikes him, he is patient and this is better for him. If a bounty is granted to him, he is thankful and this is better for him. This trait is only for the faithful believer.)