Abu Hurairah reported the Messenger of Allah (May peace be upon him) as saying; one shall have the thing the for which one comes to the mosque. (Using translation from Abū Dāʾūd 472)
قَالَ رَسُولُ اللهِ ﷺ مَنْ أَتَى الْمَسْجِدَ بِشَيْءٍ فَهُوَ حَظُّهُ