]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Models/Entity.php
Add base64 image support
[bookstack] / app / Entities / Models / Entity.php
index c6b2468b0814afd124d1c64a4e0f8b116b9ec8d5..d4b477304da8848d113b3882517a7d9bcea366f5 100644 (file)
@@ -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;
     }
 }