- /**
- * Get an instance of an entity of the given type.
- * @param $type
- * @return Entity
- */
- public static function getEntityInstance($type)
- {
- $types = ['Page', 'Book', 'Chapter', 'Bookshelf'];
- $className = str_replace([' ', '-', '_'], '', ucwords($type));
- if (!in_array($className, $types)) {
- return null;
- }
-
- return app('BookStack\\Entities\\' . $className);