Skip to content

Commit

Permalink
Don't save empty slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel committed Jun 20, 2024
1 parent d76a8a6 commit c53a105
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Models/Behaviors/HasSlug.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ public function handleSlugsOnSave(): void
$params['slug'] = Str::slug($params['slug']);
}

if (empty($params['slug'])) {
continue;
}
if ($this->slugs()->where('locale', $params['locale'])->where('slug', $params['slug'])->where('active', true)->doesntExist()) {
$this->updateOrNewSlug($params);
}
Expand Down

0 comments on commit c53a105

Please sign in to comment.