The Prophet ﷺ said, "When the deceased is placed in his grave, he hears the sound of the footsteps of those who turn away from him. If he is a believer, the prayer stands at his head, the fasting stands at his right, the zakat stands at his left, and the good deeds such as charity, maintaining ties of kinship, kindness, and goodness to people stand at his feet.Then he is approached from the direction of his head, and the prayer says, 'There is no way in from my side.'Then he is approached from his right, and the fasting says, 'There is no way in from my side.'Then he is approached from his left, and the zakat says, 'There is no way in from my side.'Then he is approached from the direction of his feet, and the good deeds such as charity, maintaining ties of kinship, and kindness to people say, 'There is no way in from my side.'"And he mentioned the hadith in its full length.
عن النبي ﷺ قال: إن الميت إذا وضع في قبره إنه ليسمع خفق نعالهم حين يولون عنه فإن كان مؤمنا كانت الصلاة عنه رأسه، وكان الصيام عن يمينه، وكانت الزكاة عن يساره، وكان فعل الخيرات من الصدقة والصلة والمعروف والإحسان إلى الناس عند رجليه، فيؤتى من قبل رأسه فتقول الصلاة: ما قبلي مدخل ثم يؤتى عن يمينه فيقول الصيام: ما قبلي مدخل ثم يؤتى عن يساره فتقول الزكاة ما قبلي مدخل ثم يؤتى من قبل رجليه فيقول فعل الخيرات من الصدقة والصلة والمعروف إلى الناس: ما قبلي مدخل وذكر الحديث بطوله.
Ibn Hibban (3113), Hakim (1/379-381), and Bayhaqi in Ithbat Azab Qabr (154) all reported it through chains of transmission from Muhammad bin Amr, from Abu Salama, from Abu Hurairah, and he related the hadith in full, and it has already been mentioned a few chapters earlier. Its chain of transmission is hasan because of Muhammad bin Amr, and his hadith is hasan.