]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/EntityProvider.php
Update maintenance.php
[bookstack] / app / Entities / EntityProvider.php
index 04939a14a411d9b344faad349ba8dd59195273cf..d0d4a7ad6c073a7737fdb0a03ef569fbef2487cb 100644 (file)
@@ -84,4 +84,23 @@ class EntityProvider
         $type = strtolower($type);
         return $this->all()[$type];
     }
+
+    /**
+     * Get the morph classes, as an array, for a single or multiple types.
+     * @param string|array $types
+     * @return array<string>
+     */
+    public function getMorphClasses($types)
+    {
+        if (is_string($types)) {
+            $types = [$types];
+        }
+
+        $morphClasses = [];
+        foreach ($types as $type) {
+            $model = $this->get($type);
+            $morphClasses[] = $model->getMorphClass();
+        }
+        return $morphClasses;
+    }
 }