Al-Bara' had a she-camel which was accustomed to graze the standing crop belonging to the people. She entered a garden and did damage to it. The Messenger of Allah ﷺ was informed about it. So he gave decision that the owners of gardens are responsible for guarding them by day, and the owners of the animals are responsible for guarding them by night. Any damage done by animals during the night is a responsibility lying on their owners. (Using translation from Abū Dāʾūd 3570)
أَخْبَرَهُ أَنَّهُ كَانَتْ لَهُ نَاقَةٌ ضَارِيَةٌ فَدَخَلَتْ حَائِطًا فَأَفْسَدَتْ فِيهِ فَكَلَّمَ رَسُولُ اللهِ ﷺ «فَقَضَى رَسُولُ اللهِ ﷺ أَنَّ حِفْظَ الْحَوَائِطِ عَلَى أَهْلِهَا بِالنَّهَارِ وَحِفْظَ الْمَوَاشِي عَلَى أَهْلِهَا بِاللَّيْلِ وَأَنَّ عَلَى أَهْلِ الْمَاشِيَةِ مَا أَصَابَتْ بِاللَّيْلِ»