]> _ Git - cubist_cms-back.git/commitdiff
fix #2959 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 23 Aug 2019 12:22:05 +0000 (14:22 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 23 Aug 2019 12:22:05 +0000 (14:22 +0200)
src/app/Magic/Models/CubistMagicAbstractModel.php

index 88cddbe9c74608e00bb9e13d2e12198dc9f8d5eb..3f1722d77b5fcd27dc87b21d4844f6998dd97346 100644 (file)
@@ -153,8 +153,16 @@ class CubistMagicAbstractModel extends Model implements HasMedia
     public function getSlugOrTitleAttribute()
     {
         foreach ($this->_slugFields as $item) {
-            if (isset($this->$item) && $this->item != '') {
-                return $this->$item;
+            $components = explode('+', $item);
+
+            $slug = [];
+            foreach ($components as $component) {
+                if (isset($this->$component) && $this->$component != '') {
+                    $slug[] = $this->$component;
+                }
+            }
+            if (count($slug) > 0) {
+                return Str::slug(implode('-', $slug));
             }
         }
     }