Dalil

Quran Ali 'Imran 3:166

وَمَآ أَصَٰبَكُمۡ يَوۡمَ ٱلۡتَقَى ٱلۡجَمۡعَانِ فَبِإِذۡنِ ٱللَّهِ وَلِيَعۡلَمَ ٱلۡمُؤۡمِنِينَ

Translation

And what struck you on the day the two armies met [at Uḥud] was by permission of Allāh that He might make evident the [true] believers