The Messenger of Allah ﷺ said, "Whoever has eaten anything from this tree should not come to the mosque."
حدثنا محمد بن الصباح حدثنا عبد الله بن رجاء المكي عن عبيد الله بن عمر عن نافع
قال رسول الله ﷺ من أكل من هذه الشجرة شيئا فلا يأتين المسجد
Bukhari related it in the Book of Adhan, chapter: What has been said about raw garlic, onions, and leeks, hadith no. 853, and elsewhere, and Muslim, the Book of Mosques, chapter: The prohibition of one who has eaten garlic, onions, leeks, or similar things... etc., hadith no. 561, from the hadith of Ubaydullah, through this same chain.