1 <?php namespace BookStack\Repos;
7 use BookStack\Services\RestrictionService;
15 private $restrictionService;
18 * EntityService constructor.
20 * @param Chapter $chapter
22 * @param RestrictionService $restrictionService
24 public function __construct(Book $book, Chapter $chapter, Page $page, RestrictionService $restrictionService)
27 $this->chapter = $chapter;
29 $this->restrictionService = $restrictionService;
33 * Get the latest books added to the system.
37 public function getRecentlyCreatedBooks($count = 20, $page = 0)
39 return $this->restrictionService->enforceBookRestrictions($this->book)
40 ->orderBy('created_at', 'desc')->skip($page*$count)->take($count)->get();
44 * Get the most recently updated books.
49 public function getRecentlyUpdatedBooks($count = 20, $page = 0)
51 return $this->restrictionService->enforceBookRestrictions($this->book)
52 ->orderBy('updated_at', 'desc')->skip($page*$count)->take($count)->get();
56 * Get the latest pages added to the system.
60 public function getRecentlyCreatedPages($count = 20, $page = 0)
62 return $this->restrictionService->enforcePageRestrictions($this->page)
63 ->orderBy('created_at', 'desc')->skip($page*$count)->take($count)->get();
67 * Get the most recently updated pages.
72 public function getRecentlyUpdatedPages($count = 20, $page = 0)
74 return $this->restrictionService->enforcePageRestrictions($this->page)
75 ->orderBy('updated_at', 'desc')->skip($page*$count)->take($count)->get();