We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e36f72b + 4378ce5 commit d1f0e90Copy full SHA for d1f0e90
src/Traits/Models/HasSlugTrait.php
@@ -25,7 +25,8 @@ public static function bootHasSlugTrait(): void
25
{
26
static::saving(function (Model $model) {
27
foreach ((new static())->sluggable as $attribute) {
28
- if (in_array($attribute, (new static())->getFillable()) || ! is_null($model->{$attribute})) {
+ /** @noinspection NotOptimalIfConditionsInspection */
29
+ if ($model->hasAttribute($attribute) && ! is_null($model->{$attribute})) {
30
$model->slug = Str::slug($model->{$attribute});
31
}
32
0 commit comments