Praying for people who were doing the work
They were digging and he saw what it was costing them.
اللَّهُمَّ إِنَّ الْخَيْرَ خَيْرُ الآخِرَهْ فَاغْفِرْ لِلأَنْصَارِ وَالْمُهَاجِرَهْ
Allāhumma inna-l-khayra khayru-l-ākhirah, fa-ghfir li-l-anṣāri wa-l-muhājirah.
“O Allah, the real good is the good of the Hereafter, so forgive the Anṣār and the Muhājirūn.”
The full narration
Narrated Anas:The Prophet (ﷺ) went out on a cold morning while the Muhajirin (emigrants) and the Ansar were digging the trench. The Prophet (ﷺ) then said, "O Allah! The real goodness is the goodness of the Here after, so please forgive the Ansar and the Muhajirin." They replied, "We are those who have given the Pledge of allegiance to Muhammad for to observe Jihad as long as we remain alive
Source
Ṣaḥīḥ al-Bukhārī · 7201
Ṣaḥīḥ
- Agreed upon as authentic (al-Bukhārī / Muslim)