]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/EntityProvider.php
Chinese translation update for v0.24.1
[bookstack] / app / Entities / EntityProvider.php
index 0442b9f44b98b850b21793dda58436018470925c..46a883ec408927661479c5d84fc8bab7cc5d5fed 100644 (file)
@@ -15,27 +15,27 @@ class EntityProvider
     /**
      * @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.
@@ -74,5 +74,16 @@ class EntityProvider
         ];
     }
 
+    /**
+     * 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