Skip to content

Commit

Permalink
Addnig static helper for ToLog
Browse files Browse the repository at this point in the history
  • Loading branch information
spekulatius committed Jul 4, 2023
1 parent da4fc86 commit 24de840
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Traits/ToLog.php
Expand Up @@ -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): array
{
// Flat and unflat the array and tweak the content along the way...
return Arr::undot(
collect(Arr::dot($data))
Expand Down

0 comments on commit 24de840

Please sign in to comment.