«كان إذا أتاه الأمر يسره قال: الحمد لله الذي بنعمته تتم الصالحات وإذا أتاه الأمر يكرهه قال: الحمد لله على كل حال»
It was the practice of the Prophet (peace and blessings be upon him):
"When something pleasing came to him (peace and blessings be upon him), he would say: 'Al-hamdu lillahil-ladhi bi-ni'matihi tatimmus-salihat' (All praise is for Allah, by whose favour good deeds are completed), and when something displeasing came to him, he would say: 'Al-hamdu lillahi 'ala kulli hal' (All praise is for Allah in every circumstance)."
Hadith Referenceصحیح الجامع الصغیر / حرف الكاف / 4640
Hadith Gradingالألبانی:صحيح
Hadith Takhrij[ابن السني في عمل اليوم والليلة ك] عن عائشة. الكلم الطيب ١٣٩، الصحيحة ٢٦٥: ك، حل - أبي هريرة. خط - ابن عباس.