عن جابر بن عبد الله رضي الله عنهما عن النبي صلى الله عليه وسلم أنه قال: «من أكل ثومًا أو بصلًا؛ فَلْيَعْتَزِلْنَا -أَوْ لِيَعْتَزِلْ مسجدنا-، وليقعد في بيته.
وأُتي بِقِدْرٍ فيه خَضِرَاتٌ من بُقُولٍ، فوجد لها ريحًا، فسأل فأخبر بما فيها من البقول، فقال: قَرِّبُوهَا إلى بعض أصحابي، فلما رآه كره أكلها، قال: كل؛ فإني أُنَاجِي من لا تُنَاجِي».
عن جابر بن عبد الله رضي الله عنهما أن النبي صلى الله عليه وسلم قال:«من أكل الثوم والبصل والْكُرَّاثَ فلا يقربن مسجدنا؛ فإن الملائكة تَتَأَذَّى مما يَتَأَذَّى منه بنو آدم». [صحيح] - [متفق عليه] المزيــد ...
Jābir ibn ‘Abdullāh (may Allah be pleased with him) reported: The Prophet (may Allah's peace and blessings be upon him) said: "Whoever eats garlic or onions should keep away from us - or our mosque - and stay at home." Someone brought him a pot of vegetables and legumes. Disliking its scent, the Prophet asked about it and was told that there were legumes in it. So, he said:"Give it to one of my Companions." When he saw it, he disliked to eat it therefrom; but the Prophet (may Allah's peace and blessings be upon him) said to him: "Eat it, for indeed I converse with One you do not converse with."
Jābir ibn ‘Abdullāh (may Allah be pleased with him) reported: The Prophet (may Allah's peace and blessings be upon him) said: "Whoever eats garlic, onions, or leeks should not come to our mosque, for indeed the angels are harmed by whatever hurts human beings.'" Sahih/Authentic. - [Al-Bukhari and Muslim with its two versions]
A worshiper is required to have the best and most pleasant scent, especially when he goes to the congregational prayer. Hence, the Prophet (may Allah's peace and blessings be upon him) ordered that whoever eats raw garlic or onions should keep away from the mosque and stay at home until the strong scent, which harms the worshipers and the angels, goes away.
When the Prophet (may Allah's peace and blessings be upon him) was brought a pot of vegetables and legumes, he disliked the smell and ordered that it be given to one of his Companions. When his Companion saw that the Prophet disliked it, he thought that it was impermissible. So he was hesitant about eating it. Thereupon, the Prophet (may Allah's peace and blessings be upon him) asked him to eat and informed him that this food was not forbidden and that he did not dislike it because of that. He further clarified that the reason behind him not eating this food was that he would converse with his Lord, something not done by others, and so he should be in the best of conditions during that close communication with Him.
Moreover, it is more appropriate to observe the public interests of the believers and keep harm away from them than to consider personal ones, here represented by attending the congregational prayer, which is to be missed in compliance with this instruction.