]> BookStack Code Mirror - bookstack/blobdiff - app/Actions/Activity.php
Code cleanup, bug squashing
[bookstack] / app / Actions / Activity.php
index 63eda591783c8d14a2fc2f478ee79b99f0bb0be8..9d256c9b2918b2cdf0d7f543662bd7a7fb920f87 100644 (file)
@@ -3,9 +3,10 @@
 namespace BookStack\Actions;
 
 use BookStack\Auth\User;
-use BookStack\Entities\Entity;
+use BookStack\Entities\Models\Entity;
 use BookStack\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Support\Str;
 
 /**
  * @property string $type
@@ -46,6 +47,16 @@ class Activity extends Model
         return trans('activities.' . $this->type);
     }
 
+    /**
+     * Check if this activity is intended to be for an entity.
+     */
+    public function isForEntity(): bool
+    {
+        return Str::startsWith($this->type, [
+            'page_', 'chapter_', 'book_', 'bookshelf_'
+        ]);
+    }
+
     /**
      * Checks if another Activity matches the general information of another.
      */