The Messenger of Allah ﷺ forbade us from eating onions and leeks, but necessity overcame us and we ate some of them. He said, "Whoever has eaten from this foul plant must not come near our mosque, for the angels are offended by what offends humans."In another narration, "Whoever has eaten from this vegetable, garlic" — and Mura once said, "Whoever has eaten onions, garlic, or leeks" — "must 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), from Abu Bakr bin Abu Shayba, who said, our teacher was Kathir bin Hisham, from Hisham Dastawai, from Abu Zubayr, from Jabir, and he related it.The second version was also narrated by Muslim through another route, from Ibn Jurayj, who said, Ataa told me, from Jabir bin Abdullah, and he related it.The two sheikhs narrated it, Bukhari in the Book of Adhan (855), and Muslim in the Book of Mosques, both of them from the hadith of Ibn Wahb, from Yunus, from Ibn Shihab, that Ataa claimed that Jabir bin Abdullah claimed that the Prophet ﷺ said, and he related the hadith at greater length, except that in this version the two of them did not mention the angels being harmed.