Anas bin Malik reported,

The Messenger of Allah ﷺ went out to the Trench and found the Emigrants and the Helpers digging on a cold morning. They had no servants to do the work for them. When he saw the exhaustion and hunger they were enduring, he said, "O Allah, true life is the life of the Hereafter, so forgive the Helpers and the Emigrants."They answered him, saying, "We are the ones who pledged allegiance to Muhammad to strive in jihad as long as we live."

Azami 8914

Sahih

عن أنس قال

خرج رسول الله ﷺ إلى الخندق فإذا المهاجرون والأنصار يحفرون في غداة باردة، فلم يكن لهم عبيد يعملون ذلك لهم، فلما رأى ما بهم من النصب والجوع قال: اللهم إن العيش عيش الآخرة، فاغفر للأنصار والمهاجرة فقالوا مجيبين له: نحن الذين بايعوا محمدا على الجهاد ما بقينا أبدا.

الأعظمي 8914صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Biography of the Prophet ﷺ
Chapter
Expedition of Ahzab
Section
Prophet ﷺ ordering the digging of the trench around Madinah and encouraging his companions to do so
Numbering
Jami al-Kamil 8914 (2nd edition)
Azami 8914