2015-08-16 15:11:21 -04:00
|
|
|
<?php
|
|
|
|
|
2015-09-10 14:31:09 -04:00
|
|
|
namespace BookStack\Http\Controllers;
|
2015-08-16 15:11:21 -04:00
|
|
|
|
2015-11-21 12:22:14 -05:00
|
|
|
use Activity;
|
2015-08-16 15:11:21 -04:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
2015-09-10 14:31:09 -04:00
|
|
|
use BookStack\Http\Requests;
|
|
|
|
use BookStack\Repos\BookRepo;
|
2015-11-21 12:22:14 -05:00
|
|
|
use Views;
|
2015-08-16 15:11:21 -04:00
|
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
protected $activityService;
|
|
|
|
protected $bookRepo;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* HomeController constructor.
|
2015-08-29 10:03:42 -04:00
|
|
|
* @param BookRepo $bookRepo
|
2015-08-16 15:11:21 -04:00
|
|
|
*/
|
2015-11-21 12:22:14 -05:00
|
|
|
public function __construct(BookRepo $bookRepo)
|
2015-08-16 15:11:21 -04:00
|
|
|
{
|
|
|
|
$this->bookRepo = $bookRepo;
|
2015-08-29 10:03:42 -04:00
|
|
|
parent::__construct();
|
2015-08-16 15:11:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the homepage.
|
|
|
|
*
|
|
|
|
* @return Response
|
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
2015-11-21 12:22:14 -05:00
|
|
|
$activity = Activity::latest();
|
2015-11-21 13:05:03 -05:00
|
|
|
$recents = $this->signedIn ? Views::getUserRecentlyViewed(10, 0) : $this->bookRepo->getLatest(10);
|
|
|
|
return view('home', ['activity' => $activity, 'recents' => $recents]);
|
2015-08-16 15:11:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|