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