forked from ArthurGuy/BBMembershipSystem
/
ActivityController.php
49 lines (37 loc) · 1.18 KB
/
ActivityController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php namespace BB\Http\Controllers;
class ActivityController extends Controller
{
/**
* @var \BB\Repo\ActivityRepository
*/
private $activityRepository;
function __construct(\BB\Repo\ActivityRepository $activityRepository)
{
$this->activityRepository = $activityRepository;
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$date = \Input::get('date', \Carbon\Carbon::now()->format('Y-m-d'));
$date = \Carbon\Carbon::createFromFormat('Y-m-d', $date)->setTime(0, 0, 0);
$today = \Carbon\Carbon::now()->setTime(0, 0, 0);
$logEntries = $this->activityRepository->getForDate($date);
$nextDate = null;
if ($date->lt($today)) {
$nextDate = $date->copy()->addDay();
}
$previousDate = $date->copy()->subDay();
return \View::make('activity.index')->with('logEntries', $logEntries)->with('date', $date)->with('nextDate', $nextDate)->with('previousDate', $previousDate);
}
/**
* @return Response
*/
public function realtime()
{
return \View::make('activity.realtime');
}
}