2015-08-17 03:11:21 +08:00
|
|
|
<?php
|
|
|
|
|
2015-09-11 02:31:09 +08:00
|
|
|
namespace BookStack\Http\Controllers;
|
2015-08-17 03:11:21 +08:00
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
2015-09-11 02:31:09 +08:00
|
|
|
use BookStack\Http\Requests;
|
|
|
|
use BookStack\Http\Controllers\Controller;
|
|
|
|
use BookStack\Repos\BookRepo;
|
|
|
|
use BookStack\Services\ActivityService;
|
|
|
|
use BookStack\Services\Facades\Activity;
|
2015-08-17 03:11:21 +08:00
|
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
protected $activityService;
|
|
|
|
protected $bookRepo;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* HomeController constructor.
|
|
|
|
* @param ActivityService $activityService
|
2015-08-29 22:03:42 +08:00
|
|
|
* @param BookRepo $bookRepo
|
2015-08-17 03:11:21 +08:00
|
|
|
*/
|
|
|
|
public function __construct(ActivityService $activityService, BookRepo $bookRepo)
|
|
|
|
{
|
|
|
|
$this->activityService = $activityService;
|
|
|
|
$this->bookRepo = $bookRepo;
|
2015-08-29 22:03:42 +08:00
|
|
|
parent::__construct();
|
2015-08-17 03:11:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the homepage.
|
|
|
|
*
|
|
|
|
* @return Response
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
$books = $this->bookRepo->getAll();
|
|
|
|
$activity = $this->activityService->latest();
|
|
|
|
return view('home', ['books' => $books, 'activity' => $activity]);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|