Abdul-Aziz reported,

Anas was asked about garlic, and he said that the Messenger of Allah ﷺ said, "Whoever eats from this plant should not come near us or pray with us."

Muslim 1250

Sahih

و حدثني زهير بن حرب حدثنا إسمعيل يعني ابن علية

عن عبد العزيز وهو ابن صهيب قال

سئل أنس عن الثوم فقال قال رسول الله ﷺ من أكل من هذه الشجرة فلا يقربنا ولا يصلي معنا

مسلم 1250صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
Prohibition on those who have eaten garlic, onions, leeks, or similar from attending the masjid
Numbering
Darussalam 1250
Muslim 1250