I think this is from the Prophet ﷺ, who said, "I saw in a dream that I was migrating from Makkah to a land with date palms. My mind went to the thought that it was Yamamah or Hajar, but it turned out to be Madinah, Yathrib. I also saw cattle in the dream, and Allah is best. They turned out to be the believers on the day of Uhud, and the good was the good that Allah brought, and the reward of truthfulness that Allah granted us after the day of Badr."
حدثني محمد بن العلاء حدثنا أبو أسامة عن بريد عن جده أبي بردة
أراه عن النبي ﷺ قال رأيت في المنام أني أهاجر من مكة إلى أرض بها نخل فذهب وهلي إلى أنها اليمامة أو هجر فإذا هي المدينة يثرب ورأيت فيها بقرا والله خير فإذا هم المؤمنون يوم أحد وإذا الخير ما جاء الله من الخير وثواب الصدق الذي آتانا الله به بعد يوم بدر