1 <?php namespace BookStack\Entities;
6 * Provides access to the core entity models.
7 * Wrapped up in this provider since they are often used together
8 * so this is a neater alternative to injecting all in individually.
10 * @package BookStack\Entities
41 * EntityProvider constructor.
42 * @param Bookshelf $bookshelf
44 * @param Chapter $chapter
46 * @param PageRevision $pageRevision
48 public function __construct(
53 PageRevision $pageRevision
55 $this->bookshelf = $bookshelf;
57 $this->chapter = $chapter;
59 $this->pageRevision = $pageRevision;
63 * Fetch all core entity types as an associated array
64 * with their basic names as the keys.
70 'bookshelf' => $this->bookshelf,
71 'book' => $this->book,
72 'chapter' => $this->chapter,
73 'page' => $this->page,
78 * Get an entity instance by it's basic name.
82 public function get(string $type)
84 $type = strtolower($type);
85 return $this->all()[$type];