diff --git a/src/LaravelUuidServiceProvider.php b/src/LaravelUuidServiceProvider.php index 94a7700..3b9b9a5 100644 --- a/src/LaravelUuidServiceProvider.php +++ b/src/LaravelUuidServiceProvider.php @@ -34,8 +34,6 @@ public function boot() */ public function register() { - $this->app->singleton(UUIDManager::class, function () { - return new UUIDManager(); - }); + // } } diff --git a/src/UUIDManager.php b/src/UUIDManager.php deleted file mode 100644 index aa6e4a3..0000000 --- a/src/UUIDManager.php +++ /dev/null @@ -1,53 +0,0 @@ -generate(); - - $this->uuid = $uuid; - - return $uuid; - } - -/* public function __toString() - { - return $this->uuid; - }*/ - - - /** - * - * This function will return a UUID - * - * @return type string - */ - public static function generate() - { - - mt_srand((double)microtime()*10000); - $charid = strtoupper(md5(uniqid(rand(), true))); - $hyphen = chr(45);// "-" - $uuid = chr(123)// "{" - .substr($charid, 0, 8).$hyphen - .substr($charid, 8, 4).$hyphen - .substr($charid,12, 4).$hyphen - .substr($charid,16, 4).$hyphen - .substr($charid,20,12) - .chr(125);// "}" - - $uuid = str_replace('{', '' , $uuid); - $uuid = str_replace('}', '' , $uuid); - - return $uuid; - - } -} \ No newline at end of file diff --git a/src/Uuids.php b/src/Uuids.php index 4a2a92c..132ff18 100644 --- a/src/Uuids.php +++ b/src/Uuids.php @@ -1,7 +1,7 @@ {config('uuid.default_uuid_column')} = UUIDManager::generate(); + $model->{config('uuid.default_uuid_column')} = strtoupper(Uuid::uuid4()->toString()); }); static::saving(function ($model) { $original_uuid = $model->getOriginal(config('uuid.default_uuid_column')); @@ -43,4 +43,4 @@ public function scopeUuid($query, $uuid, $first = true) return $first ? $results->firstOrFail() : $results; } -} \ No newline at end of file +}