fix(models): auto-generate ulid on creating for Workspace and Link

main
boban 2026-05-16 00:23:33 +02:00
parent d0bb8f92ee
commit dc6ed34357
2 changed files with 18 additions and 0 deletions

View File

@ -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',

View File

@ -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',