Abu Huraira reported Allah's Messenger (ﷺ) as saying:
وَحَدَّثَنَا مُحَمَّدُ بۡنُ رَافِعٍ، حَدَّثَنَا عَبۡدُ الرَّزَّاقِ، حَدَّثَنَا مَعۡمَرٌ، عَنۡ هَمَّامِ بۡنِ مُنَبِّهٍ، قَالَ هَذَا مَا حَدَّثَنَا أَبُو هُرَيۡرَةَ، عَنۡ رَسُولِ اللَّهِ صلى الله عليه وسلم فَذَكَرَ أَحَادِيثَ مِنۡهَا وَقَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم
" نِعِمَّا لِلۡمَمۡلُوكِ أَنۡ يُتَوَفَّى يُحۡسِنُ عِبَادَةَ اللَّهِ وَصَحَابَةَ سَيِّدِهِ نِعِمَّا لَهُ " .
Translation
Muhammad ibn Rafi narrated to us: Abd al-Razzaq narrated to us: Mamar narrated to us from Hammam ibn Munabbih, who said: This is what Abu Hurayrah رضي الله تعالى عنه narrated to us from the Messenger of Allah صلى الله عليه وآله وسلم. He mentioned several reports, including the following:
The Messenger of Allah صلى الله عليه وآله وسلم said, “How excellent it is for an enslaved person to die while worshipping Allah well and keeping good company with his master! How excellent it is for him!”