Assalam-i-Alaikam. I am not a scholar, but passionate about learning. In my opinion and based on particle physics, this universe and everything we feel from our 5 senses is the result of our observation or awareness. Considering this, I believe, if someone has a very strong belief in Allah and trusts Allah, then everything that happens leads to a better conclusion. Whether that conclusion may be in this World or the life afterwards. But, in fact what only matters is the life afterwards which is eternal. This life is not even equal to a blink of an eye as compared to eternal life. So for people who follow true Islam, trust Allah and are righteous, for them everything happens for good. For those who are deviant everything leads to worse conclusion. For example, a believer asks Allah for enough money to be out of poverty. But Allah doesn’t seem to listen to him. The reason is likely that Allah has given the person a free will and Allah knows his future. Allah knows that if I even bring him out of poverty, he might go on the wrong path or get into trouble. Now let’s look at the person who begged Allah to bring him out of poverty and Allah doesn’t seem to listen to him. If he is a true believer, he will always be satisfied in his heart and happy, believing that Allah is listening and making the best judgement for him. I do not remember the Ayah, but in Quran it states somewhere that what you wish for may not be good for you and what you shun may be good for you.
This is my take, I am sure soon a scholar will answer this question in light of authentic references.