fix(models): auto-generate ulid on creating for Workspace and Link
parent
d0bb8f92ee
commit
dc6ed34357
|
|
@ -13,6 +13,15 @@ class Link extends Model
|
|||
|
||||
protected $guarded = ['id', 'workspace_id', 'created_by'];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function (self $model) {
|
||||
if (empty($model->ulid)) {
|
||||
$model->ulid = \Illuminate\Support\Str::ulid();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected $casts = [
|
||||
'rules' => 'array',
|
||||
'pixel_config' => 'array',
|
||||
|
|
|
|||
|
|
@ -13,6 +13,15 @@ class Workspace extends Model
|
|||
|
||||
protected $guarded = ['id', 'owner_id'];
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::creating(function (self $model) {
|
||||
if (empty($model->ulid)) {
|
||||
$model->ulid = \Illuminate\Support\Str::ulid();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected $casts = [
|
||||
'branding' => 'array',
|
||||
'stripe_customer_metadata' => 'array',
|
||||
|
|
|
|||
Loading…
Reference in New Issue