fix: generate user slug on creation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
b60fd99f0a
commit
029689407b
@@ -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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user