It was narrated from Ibn 'Umar that the Messenger of Allah (ﷺ) said:
"When anyone of you passes by a garden let him eat therefrom, but he should not carry any away in his garment."'