]> _ Git - cubist_cms-back.git/commitdiff
#2783
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 24 May 2019 15:45:13 +0000 (17:45 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 24 May 2019 15:45:13 +0000 (17:45 +0200)
src/app/Magic/Models/CubistMagicModelAbstract.php

index 1642fd049908773b8d3edfc434f828accc0861a1..a0125162035da2da78851f894c2a5700ee4271bc 100644 (file)
@@ -6,6 +6,8 @@ namespace Cubist\Backpack\app\Magic\Models;
 use Backpack\CRUD\CrudTrait;
 use Cubist\Backpack\app\Magic\Fields\Field;
 use Cubist\Backpack\app\Magic\Util;
+use Cviebrock\EloquentSluggable\Sluggable;
+use Cviebrock\EloquentSluggable\SluggableScopeHelpers;
 use Illuminate\Database\Eloquent\Model;
 use Cubist\Backpack\app\Magic\CubistMagicAttribute;
 use Illuminate\Support\Str;
@@ -15,6 +17,7 @@ class CubistMagicModelAbstract extends Model
 
     use CubistMagicAttribute;
     use CrudTrait;
+    use Sluggable, SluggableScopeHelpers;
 
     /**
      * @var Field[]
@@ -39,6 +42,20 @@ class CubistMagicModelAbstract extends Model
         $this->fill($attributes);
     }
 
+    /**
+     * Return the sluggable configuration array for this model.
+     *
+     * @return array
+     */
+    public function sluggable()
+    {
+        return [
+            'slug' => [
+                'source' => 'slug_or_name_or_title',
+            ],
+        ];
+    }
+
     public function getOption($key, $default = null)
     {
         if (isset($this->_options[$key])) {