From b0ca27f5a404564d8c9f3dd49bbb81915467d4b4 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 22 Jan 2024 14:20:00 +0800 Subject: [PATCH] [10.x] Only use `Carbon` if accessed from Laravel or also uses `illuminate/support` fixes #49765 Signed-off-by: Mior Muhammad Zaki --- src/Illuminate/Collections/LazyCollection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Collections/LazyCollection.php b/src/Illuminate/Collections/LazyCollection.php index ce84977aad99..e741ba0bf0a0 100644 --- a/src/Illuminate/Collections/LazyCollection.php +++ b/src/Illuminate/Collections/LazyCollection.php @@ -1740,6 +1740,8 @@ protected function passthru($method, array $params) */ protected function now() { - return Carbon::now()->timestamp; + return class_exists(Carbon::class) + ? Carbon::now()->timestamp + : time(); } }