Garlic and onions were mentioned in the presence of the Messenger of Allah ﷺ, and someone said, "Messenger of Allah, the strongest of them all is garlic. Are you forbidding it?"The Prophet ﷺ replied, "Eat it, but whoever among you eats it should not come near this mosque until its odor has left him."
حدثنا أحمد بن صالح حدثنا ابن وهب أخبرني عمرو أن بكر بن سوادة حدثه أن أبا النجيب مولى عبد الله بن سعد حدثه أن
أنه ذكر عند رسول الله ﷺ الثوم والبصل وقيل يا رسول الله وأشد ذلك كله الثوم أفتحرمه فقال النبي ﷺ كلوه ومن أكله منكم فلا يقرب هذا المسجد حتى يذهب ريحه منه
No references are available.
[Its isnad is hasan] Ibn Khuzayma reported it, no. 1669, from the hadith of Abdullah bin Wahb, with this wording, and Ibn Hibban graded it sahih, no. 318. Abu Najib's hadith is hasan.