Skip to content

Commit

Permalink
fix: Compatible with 10.x versions of illuminate/database
Browse files Browse the repository at this point in the history
  • Loading branch information
Chance-fyi committed Dec 22, 2023
1 parent 474c52d commit bfb73bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/orm/illuminate/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Chance\Log\OperationLogInterface;
use Illuminate\Database\Eloquent\Casts\ArrayObject;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\Str;

class Log extends OperationLog implements OperationLogInterface
Expand Down Expand Up @@ -87,6 +88,12 @@ public function getValue($model, string $key): string
return json_encode($value, JSON_UNESCAPED_UNICODE);
}

if (is_object($value) && $value instanceof Expression) {
// Compatible with version 10.x
// @phpstan-ignore-next-line
return $value->getValue($model->getConnection()->getQueryGrammar());
}

return (string) $value;
}

Expand Down

0 comments on commit bfb73bc

Please sign in to comment.