The Messenger of Allah ﷺ lay down on a straw mat, and it left marks on his side. When he awoke, I began to rub his side and said, "Messenger of Allah, why did you not let us know so we could spread something for you over the mat?"The Messenger of Allah ﷺ replied, "What have I to do with this world? What am I to this world? My example and the example of this world is only like a rider who took shade under a tree, then moved on and left it behind."
حدثنا يزيد أخبرنا المسعودي عن عمرو بن مرة عن إبراهيم النخعي عن علقمة
اضطجع رسول الله ﷺ على حصير فأثر في جنبه فلما استيقظ جعلت أمسح جنبه فقلت يا رسول الله ألا آذنتنا حتى نبسط لك على الحصير شيئا فقال رسول الله ﷺ ما لي وللدنيا ما أنا والدنيا إنما مثلي ومثل الدنيا كراكب ظل تحت شجرة ثم راح وتركها
Its isnad is sahih. Ibn Kathir cited it in al-Tarikh 6:49 from the Musnad of Tayalisi, from Masudi, then said, Ibn Majah narrated it from Yahya bin Hakeem from Abu Dawud Tayalisi, with the same wording. Tirmidhi narrated it from Musa bin Abdul-Rahman Kindi from Zayd bin Hubab, both of them from Masudi, with the same wording. Tirmidhi said, hasan sahih. Its meaning has already appeared as well in the hadith of Ibn Abbas, 2744.