The Prophet ﷺ said, "Whoever eats from this plant, garlic," and on another occasion he said, "Whoever eats onions, garlic, and leeks, let him not come near our mosque, for the angels are offended by what offends the children of Adam."
عن النبي ﷺ قال: من أكل من هذه البقلة الثوم- وقال مرة: من أكل البصل والثوم والكراث- فلا يقربن مسجدنا، فإن الملائكة تتأذى مما تتأذى منه بنو آدم.
Muslim narrated it in "The Book of Mosques" (564:74), from Muhammad bin Hatim, who said, Yahya bin Saeed narrated to us, from Ibn Jurayj, who said, Ata told me, from Jabir, and he mentioned it.