/**
* @var Bookshelf
*/
- protected $bookshelf;
+ public $bookshelf;
/**
* @var Book
*/
- protected $book;
+ public $book;
/**
* @var Chapter
*/
- protected $chapter;
+ public $chapter;
/**
* @var Page
*/
- protected $page;
+ public $page;
/**
* @var PageRevision
*/
- protected $pageRevision;
+ public $pageRevision;
/**
* EntityProvider constructor.
];
}
+ /**
+ * Get an entity instance by it's basic name.
+ * @param string $type
+ * @return Entity
+ */
+ public function get(string $type)
+ {
+ $type = strtolower($type);
+ return $this->all()[$type];
+ }
-}
\ No newline at end of file
+ /**
+ * 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;
+ }
+}