X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ffc1aa873ed8912c1400d83191d2b1485e59fca3..refs/pull/1462/head:/app/Entities/EntityProvider.php diff --git a/app/Entities/EntityProvider.php b/app/Entities/EntityProvider.php index 46a883ec4..d0d4a7ad6 100644 --- a/app/Entities/EntityProvider.php +++ b/app/Entities/EntityProvider.php @@ -85,5 +85,22 @@ class EntityProvider return $this->all()[$type]; } + /** + * Get the morph classes, as an array, for a single or multiple types. + * @param string|array $types + * @return array + */ + public function getMorphClasses($types) + { + if (is_string($types)) { + $types = [$types]; + } -} \ No newline at end of file + $morphClasses = []; + foreach ($types as $type) { + $model = $this->get($type); + $morphClasses[] = $model->getMorphClass(); + } + return $morphClasses; + } +}