Skip to content

Commit 4ca09fd

Browse files
authored
Merge pull request #4 from EmadAdly/dev
update uuid generator method ✏️
2 parents 9cdf5e3 + 7b4d83d commit 4ca09fd

File tree

3 files changed

+4
-59
lines changed

3 files changed

+4
-59
lines changed

src/LaravelUuidServiceProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public function boot()
3434
*/
3535
public function register()
3636
{
37-
$this->app->singleton(UUIDManager::class, function () {
38-
return new UUIDManager();
39-
});
37+
//
4038
}
4139
}

src/UUIDManager.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/Uuids.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace Emadadly\LaravelUuid;
33

4-
use Emadadly\LaravelUuid\UUIDManager;
4+
use Ramsey\Uuid\Uuid;
55
use Illuminate\Database\Eloquent\ModelNotFoundException;
66

77
trait Uuids
@@ -14,7 +14,7 @@ protected static function boot()
1414
{
1515
parent::boot();
1616
static::creating(function ($model) {
17-
$model->{config('uuid.default_uuid_column')} = UUIDManager::generate();
17+
$model->{config('uuid.default_uuid_column')} = strtoupper(Uuid::uuid4()->toString());
1818
});
1919
static::saving(function ($model) {
2020
$original_uuid = $model->getOriginal(config('uuid.default_uuid_column'));
@@ -43,4 +43,4 @@ public function scopeUuid($query, $uuid, $first = true)
4343
return $first ? $results->firstOrFail() : $results;
4444
}
4545

46-
}
46+
}

0 commit comments

Comments
 (0)