From 54f4432809c53846327b2e2da28e80324aed3f72 Mon Sep 17 00:00:00 2001 From: Tofandel Date: Thu, 20 Jun 2024 17:31:43 +0200 Subject: [PATCH] Don't save empty slugs --- src/Models/Behaviors/HasSlug.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Models/Behaviors/HasSlug.php b/src/Models/Behaviors/HasSlug.php index 8da67aab1..64cb7e860 100644 --- a/src/Models/Behaviors/HasSlug.php +++ b/src/Models/Behaviors/HasSlug.php @@ -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); }