]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/BookController.php
Added better entity deletion and commented up repos
[bookstack] / app / Http / Controllers / BookController.php
index eb9bf7ababd14f8a23b818a2426b6a4e4718c2e4..e7ade577e0e3325a35ac93523b59480179c4efe4 100644 (file)
@@ -11,6 +11,7 @@ use BookStack\Http\Requests;
 use BookStack\Repos\BookRepo;
 use BookStack\Repos\ChapterRepo;
 use BookStack\Repos\PageRepo;
+use Views;
 
 class BookController extends Controller
 {
@@ -41,7 +42,8 @@ class BookController extends Controller
     public function index()
     {
         $books = $this->bookRepo->getAllPaginated(10);
-        return view('books/index', ['books' => $books]);
+        $recents = $this->signedIn ? $this->bookRepo->getRecentlyViewed(10, 0) : false;
+        return view('books/index', ['books' => $books, 'recents' => $recents]);
     }
 
     /**
@@ -86,6 +88,7 @@ class BookController extends Controller
     public function show($slug)
     {
         $book = $this->bookRepo->getBySlug($slug);
+        Views::add($book);
         return view('books/show', ['book' => $book, 'current' => $book]);
     }