Chapter: Prohibiting one who has eaten garlic, onions, or leeks, and other things that have an offensive odor from coming to the masjid, until that smell has gone away, and such a person should be expelled from the masjid
Ibn Suhaib reported: Anas was asked about the garlic; he stated that the Messenger of Allah ( صلی اللہ علیہ وسلم ) had said: He who eats of this plant (garlic) should not approach us and pray along with us.
Authentic