]> BookStack Code Mirror - bookstack/blob - app/Http/Controllers/HomeController.php
Fixed some bugs and added a proper home page
[bookstack] / app / Http / Controllers / HomeController.php
1 <?php
2
3 namespace Oxbow\Http\Controllers;
4
5 use Illuminate\Http\Request;
6
7 use Oxbow\Http\Requests;
8 use Oxbow\Http\Controllers\Controller;
9 use Oxbow\Repos\BookRepo;
10 use Oxbow\Services\ActivityService;
11 use Oxbow\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     }
29
30
31     /**
32      * Display the homepage.
33      *
34      * @return Response
35      */
36     public function index()
37     {
38         $books = $this->bookRepo->getAll();
39         $activity = $this->activityService->latest();
40         return view('home', ['books' => $books, 'activity' => $activity]);
41     }
42
43 }