Set default value uuid?
nguyenvuvn opened this issue · 3 comments
nguyenvuvn commented
How set default value uuid? Help me?
webpatser commented
what do you mean. A UUID by default is always different?
Karuna053 commented
I'm assuming he means to set up an automated uuid by default for a database column.
webpatser commented
/**
* Setup model event hooks
*/
public static function boot()
{
parent::boot();
self::creating(function ($model) {
$model->uuid = (string) Uuid::generate(4);
});
}
Something like this?