Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 1cf93f5

Browse files
use ramsey/uuid's fromBytes and fromString resolvers
1 parent 381b7cd commit 1cf93f5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Casts/EfficientUuid.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Dyrynda\Database\Casts;
44

55
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
6+
use Ramsey\Uuid\Uuid;
67

78
class EfficientUuid implements CastsAttributes
89
{
@@ -17,7 +18,7 @@ class EfficientUuid implements CastsAttributes
1718
*/
1819
public function get($model, string $key, $value, array $attributes)
1920
{
20-
return $model->resolveUuid()->fromBytes($value)->toString();
21+
return Uuid::fromBytes($value)->toString();
2122
}
2223

2324
/**
@@ -32,7 +33,7 @@ public function get($model, string $key, $value, array $attributes)
3233
public function set($model, string $key, $value, array $attributes)
3334
{
3435
return [
35-
$key => $model->resolveUuid()->fromString(strtolower($value))->getBytes(),
36+
$key => Uuid::fromString(strtolower($value))->getBytes(),
3637
];
3738
}
3839
}

0 commit comments

Comments
 (0)