]> BookStack Code Mirror - bookstack/blob - app/Http/Controllers/HomeController.php
Fixes #58
[bookstack] / app / Http / Controllers / HomeController.php
1 <?php
2
3 namespace BookStack\Http\Controllers;
4
5 use Activity;
6 use Illuminate\Http\Request;
7
8 use BookStack\Http\Requests;
9 use BookStack\Repos\BookRepo;
10 use Views;
11
12 class HomeController extends Controller
13 {
14
15     protected $activityService;
16     protected $bookRepo;
17
18     /**
19      * HomeController constructor.
20      * @param BookRepo        $bookRepo
21      */
22     public function __construct(BookRepo $bookRepo)
23     {
24         $this->bookRepo = $bookRepo;
25         parent::__construct();
26     }
27
28
29     /**
30      * Display the homepage.
31      *
32      * @return Response
33      */
34     public function index()
35     {
36         $activity = Activity::latest();
37         $recents = $this->signedIn ? Views::getUserRecentlyViewed(10, 0) : $this->bookRepo->getLatest(10);
38         return view('home', ['activity' => $activity, 'recents' => $recents]);
39     }
40
41 }