From e1ad523709104db9744a1892357ccd0d40753d15 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 24 May 2019 17:45:13 +0200 Subject: [PATCH] #2783 --- .../Magic/Models/CubistMagicModelAbstract.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/app/Magic/Models/CubistMagicModelAbstract.php b/src/app/Magic/Models/CubistMagicModelAbstract.php index 1642fd0..a012516 100644 --- a/src/app/Magic/Models/CubistMagicModelAbstract.php +++ b/src/app/Magic/Models/CubistMagicModelAbstract.php @@ -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])) { -- 2.39.5