webpatser/laravel-uuid

Set default value uuid?

nguyenvuvn opened this issue · 3 comments

How set default value uuid? Help me?

what do you mean. A UUID by default is always different?

I'm assuming he means to set up an automated uuid by default for a database column.

/**
 *  Setup model event hooks
 */
public static function boot()
{
    parent::boot();
    self::creating(function ($model) {
        $model->uuid = (string) Uuid::generate(4);
    });
}

Something like this?