Al-Ilmam bi-Ahadith al-Ahkam 436
وَأخرج أَيْضا من حَدِيث عقبَة بن عَامر: " أَن النَّبِي ﷺ خرج يَوْمًا فَصَلى عَلَى قَتْلَى أحد صلَاته عَلَى الْمَيِّت، ثمَّ انْصَرف إِلَى الْمِنْبَر فَقَالَ: إِنِّي فرط لكم، وَأَنا شَهِيد عَلَيْكُم ". الحَدِيث. وَفِي رِوَايَة: قَالَ: " صَلَّى رَسُول الله ﷺ عَلَى قَتْلَى أحد بعد ثَمَان سِنِين كَالْمُودعِ للأحياء والأموات ". الحَدِيث.
And he also recorded, from the hadith of ʿUqbah ibn ʿAmir: "The Prophet ﷺ went out one day and prayed over those killed at Uhud his prayer over the dead. Then he went to the minbar and said: 'I will go ahead of you, and I am a witness over you'" — the hadith. And in a narration: He said: "The Messenger of Allah ﷺ prayed over those killed at Uhud after eight years, like one bidding farewell to the living and the dead" — the hadith.