Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 8fe8015

Browse files
committed
can set null name and slug
1 parent f84ccd3 commit 8fe8015

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Sluggable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ public static function findBySlug(string $slug): ?self
1111
return self::where('slug', strtolower($slug))->first();
1212
}
1313

14-
public function setNameAttribute(string $value): void
14+
public function setNameAttribute(?string $value): void
1515
{
1616
$this->attributes['name'] = $value;
17-
$this->attributes['slug'] = Str::slug($value);
17+
$this->attributes['slug'] = Str::slug($value) ?: null;
1818
}
1919
}

0 commit comments

Comments
 (0)