Skip to content

Commit

Permalink
Merge pull request #4 from EmadAdly/dev
Browse files Browse the repository at this point in the history
update uuid generator method ✏️
  • Loading branch information
EmadAdly authored Jun 21, 2017
2 parents 9cdf5e3 + 7b4d83d commit 4ca09fd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 59 deletions.
4 changes: 1 addition & 3 deletions src/LaravelUuidServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public function boot()
*/
public function register()
{
$this->app->singleton(UUIDManager::class, function () {
return new UUIDManager();
});
//
}
}
53 changes: 0 additions & 53 deletions src/UUIDManager.php

This file was deleted.

6 changes: 3 additions & 3 deletions src/Uuids.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Emadadly\LaravelUuid;

use Emadadly\LaravelUuid\UUIDManager;
use Ramsey\Uuid\Uuid;
use Illuminate\Database\Eloquent\ModelNotFoundException;

trait Uuids
Expand All @@ -14,7 +14,7 @@ protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->{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'));
Expand Down Expand Up @@ -43,4 +43,4 @@ public function scopeUuid($query, $uuid, $first = true)
return $first ? $results->firstOrFail() : $results;
}

}
}

0 comments on commit 4ca09fd

Please sign in to comment.