webpatser/laravel-uuid

UUID in model factories

mnengwa opened this issue · 0 comments

I created a parent class Model which I inherit in other model classes. The Parent class Model carries this logic
public static function boot()
{
parent::boot();
self::creating(function ($model) {
$model->uuid = (string) Uuid::generate(4);
});
}

But as the factory runs on the second item, the same UUID generated on the first item is used. Kindly assist with implementation on factories. This is my seeder class

factory(App\User::class, 50)->create();
I get it is not an issue with the package but kindly help. This is my first project with non-incrementing ids