Jami` at-Tirmidhi, Hadith 2465

Anas bin Malik narrated that the Messenger of Allah said: "Whoever makes the Hereafter his goal, Allah makes his heart rich, and organizes his affairs, and the world comes to him whether it wants to or not. And whoever makes the world his goal, Allah puts his poverty right before his eyes, and disorganizes his affairs, and the world does not come to him, except what has been decreed for him."

حَدَّثَنَا هَنَّادٌ، حَدَّثَنَا وَكِيعٌ، عَنِ الرَّبِيعِ بْنِ صَبِيحٍ، عَنْ يَزِيدَ بْنِ أَبَانَ، وَهُوَ الرَّقَاشِيُّ عَنْ أَنَسِ بْنِ مَالِكٍ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ مَنْ كَانَتِ الآخِرَةُ هَمَّهُ جَعَلَ اللَّهُ غِنَاهُ فِي قَلْبِهِ وَجَمَعَ لَهُ شَمْلَهُ وَأَتَتْهُ الدُّنْيَا وَهِيَ رَاغِمَةٌ وَمَنْ كَانَتِ الدُّنْيَا هَمَّهُ جَعَلَ اللَّهُ فَقْرَهُ بَيْنَ عَيْنَيْهِ وَفَرَّقَ عَلَيْهِ شَمْلَهَ وَلَمْ يَأْتِهِ مِنَ الدُّنْيَا إِلاَّ مَا قُدِّرَ لَهُ ‏" ‏ ‏.‏

sunnah.com