Skip to content

Commit 109a46b

Browse files
committed
generate model id on saving instead of creating
1 parent c55ff5a commit 109a46b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/HasRandomId.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ trait HasRandomId
3131
*/
3232
public static function bootHasRandomId(): void
3333
{
34-
static::creating(function ($model) {
34+
static::saving(function ($model) {
3535
if (empty($model->{$model->getRandomIdKeyName()})) {
3636
$model->generateRandomId();
3737
}

0 commit comments

Comments
 (0)