X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a6633642232efd164d4708967ab59e498fbff896..refs/pull/2700/head:/app/Entities/Models/Entity.php diff --git a/app/Entities/Models/Entity.php b/app/Entities/Models/Entity.php index c6b2468b0..d4b477304 100644 --- a/app/Entities/Models/Entity.php +++ b/app/Entities/Models/Entity.php @@ -9,6 +9,7 @@ use BookStack\Auth\Permissions\JointPermission; use BookStack\Entities\Tools\SearchIndex; use BookStack\Entities\Tools\SlugGenerator; use BookStack\Facades\Permissions; +use BookStack\Interfaces\Sluggable; use BookStack\Model; use BookStack\Traits\HasCreatorAndUpdater; use BookStack\Traits\HasOwner; @@ -37,7 +38,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @method static Builder withLastView() * @method static Builder withViewCount() */ -abstract class Entity extends Model +abstract class Entity extends Model implements Sluggable { use SoftDeletes; use HasCreatorAndUpdater; @@ -289,11 +290,11 @@ abstract class Entity extends Model } /** - * Generate and set a new URL slug for this model. + * @inheritdoc */ public function refreshSlug(): string { - $this->slug = (new SlugGenerator)->generate($this); + $this->slug = app(SlugGenerator::class)->generate($this); return $this->slug; } }