fix: generate user slug on creation

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Doar Mihai
2026-10-17 15:54:54 +03:00
co-authored by Claude Sonnet 5.5
parent b60fd99f0a
commit 029689407b
+11
View File
@@ -165,6 +165,17 @@ class User extends Authenticatable
return $slug; return $slug;
} }
protected static function boot()
{
parent::boot();
static::creating(function ($user) {
if (empty($user->slug)) {
$user->slug = static::generateUniqueSlug($user->name);
}
});
}
/** /**
* Get the route key for the model. * Get the route key for the model.
*/ */