The Messenger of Allah ﷺ said, on the first day, "Whoever eats from this plant, garlic," then he said, "garlic, onions, and leeks, let him not come near us in our mosques, for the angels are offended by what offends humans."
أخبرنا إسحق بن منصور قال حدثنا يحيى عن ابن جريج قال حدثنا عطاء
قال رسول الله ﷺ من أكل من هذه الشجرة قال أول يوم الثوم ثم قال الثوم والبصل والكراث فلا يقربنا في مساجدنا فإن الملائكة تتأذى مما يتأذى منه الإنس
Muslim transmitted it in the Book of Mosques, chapter "Prohibition of one who has eaten garlic, onion, leek, or the like...," hadith no. 74/564, from the hadith of Yahya bin Saeed Qattan. Bukhari transmitted it in the Book of Adhan, chapter "What has been said concerning raw garlic, onion, and leek," hadith no. 854, from the hadith of Ibn Jurayj, through the same chain. It is also found in the Kubra, hadith no. 786.Tirmidhi transmitted it in the Book of Foods, chapter "What has been said concerning the dislike of eating garlic and onion," hadith no. 1806, from Ishaq bin Mansur, through the same chain, and he said, hasan sahih.