]> BookStack Code Mirror - bookstack/blobdiff - app/Repos/EntityRepo.php
Add APP_LOGGING
[bookstack] / app / Repos / EntityRepo.php
index b1b69814de9ea46b9b3ffd4899190f88b0d76433..449e3aa7d91c10171c7825a432875c82c44bcd42 100644 (file)
@@ -219,6 +219,7 @@ class EntityRepo
      * @param int $count
      * @param int $page
      * @param bool|callable $additionalQuery
+     * @return Collection
      */
     public function getRecentlyCreated($type, $count = 20, $page = 0, $additionalQuery = false)
     {
@@ -237,6 +238,7 @@ class EntityRepo
      * @param int $count
      * @param int $page
      * @param bool|callable $additionalQuery
+     * @return Collection
      */
     public function getRecentlyUpdated($type, $count = 20, $page = 0, $additionalQuery = false)
     {
@@ -330,7 +332,7 @@ class EntityRepo
             if ($rawEntity->entity_type === 'BookStack\\Page') {
                 $entities[$index] = $this->page->newFromBuilder($rawEntity);
                 if ($renderPages) {
-                    $entities[$index]->html = $rawEntity->description;
+                    $entities[$index]->html = $rawEntity->html;
                     $entities[$index]->html = $this->renderPage($entities[$index]);
                 };
             } else if ($rawEntity->entity_type === 'BookStack\\Chapter') {
@@ -357,6 +359,7 @@ class EntityRepo
      * Get the child items for a chapter sorted by priority but
      * with draft items floated to the top.
      * @param Chapter $chapter
+     * @return \Illuminate\Database\Eloquent\Collection|static[]
      */
     public function getChapterChildren(Chapter $chapter)
     {
@@ -470,7 +473,7 @@ class EntityRepo
 
     /**
      * Update entity details from request input.
-     * Use for books and chapters
+     * Used for books and chapters
      * @param string $type
      * @param Entity $entityModel
      * @param array $input
@@ -569,7 +572,7 @@ class EntityRepo
 
         $draftPage->save();
         $this->savePageRevision($draftPage, trans('entities.pages_initial_revision'));
-
+        $this->searchService->indexEntity($draftPage);
         return $draftPage;
     }
 
@@ -918,7 +921,7 @@ class EntityRepo
     public function restorePageRevision(Page $page, Book $book, $revisionId)
     {
         $this->savePageRevision($page);
-        $revision = $this->getById('page_revision', $revisionId);
+        $revision = $page->revisions()->where('id', '=', $revisionId)->first();
         $page->fill($revision->toArray());
         $page->slug = $this->findSuitableSlug('page', $page->name, $page->id, $book->id);
         $page->text = strip_tags($page->html);