From: Vincent Vanwaelscappel Date: Fri, 24 May 2019 15:45:13 +0000 (+0200) Subject: #2783 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e1ad523709104db9744a1892357ccd0d40753d15;p=cubist_cms-back.git #2783 --- 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])) {