From b91046d132aa457dff2936085b16319fdc5499e7 Mon Sep 17 00:00:00 2001 From: Peter Date: Tue, 4 Jul 2023 14:20:09 +0200 Subject: [PATCH] Addnig static helper for ToLog --- src/Traits/ToLog.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Traits/ToLog.php b/src/Traits/ToLog.php index 1d0c729..7044192 100644 --- a/src/Traits/ToLog.php +++ b/src/Traits/ToLog.php @@ -25,10 +25,11 @@ trait ToLog public function toLog(array $data = null): array { // If no $data is provided, we are using ->toArray() - if (is_null($data)) { - $data = $this->toArray(); - } + return self::convert($data ?? $this->toArray()); + } + public static function convert(array $data) + { // Flat and unflat the array and tweak the content along the way... return Arr::undot( collect(Arr::dot($data))