|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Gitamin. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright (C) 2015-2016 The Gitamin Team |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Gitamin\Http\Controllers\Dashboard; |
|
13
|
|
|
|
|
14
|
|
|
use Gitamin\Models\Moment; |
|
15
|
|
|
use Illuminate\Routing\Controller; |
|
16
|
|
|
use Illuminate\Support\Facades\View; |
|
17
|
|
|
|
|
18
|
|
|
class MomentController extends Controller |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* Display a listing of the resource. |
|
22
|
|
|
* |
|
23
|
|
|
* @return \Illuminate\Http\Response |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Array of sub-menu items. |
|
28
|
|
|
* |
|
29
|
|
|
* @var array |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $subMenu = []; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Creates a new moment controller instance. |
|
35
|
|
|
* |
|
36
|
|
|
* @return void |
|
|
|
|
|
|
37
|
|
|
*/ |
|
38
|
|
|
public function __construct() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->subMenu = [ |
|
41
|
|
|
'moments' => [ |
|
42
|
|
|
'title' => trans('dashboard.moments.all'), |
|
43
|
|
|
'url' => route('dashboard.moments.index'), |
|
44
|
|
|
'icon' => 'fa fa-sliders', |
|
45
|
|
|
'active' => false, |
|
46
|
|
|
], |
|
47
|
|
|
'project_update' => [ |
|
48
|
|
|
'title' => trans('dashboard.moments.project_update'), |
|
49
|
|
|
'url' => route('dashboard.moments.index'), |
|
50
|
|
|
'icon' => 'fa fa-edit', |
|
51
|
|
|
'active' => false, |
|
52
|
|
|
], |
|
53
|
|
|
'topic' => [ |
|
54
|
|
|
'title' => trans('dashboard.moments.topic'), |
|
55
|
|
|
'url' => route('dashboard.moments.index'), |
|
56
|
|
|
'icon' => 'fa fa-comment', |
|
57
|
|
|
'active' => false, |
|
58
|
|
|
], |
|
59
|
|
|
'watched_project' => [ |
|
60
|
|
|
'title' => trans('dashboard.moments.watched_project'), |
|
61
|
|
|
'url' => route('dashboard.moments.index'), |
|
62
|
|
|
'icon' => 'fa fa-eye', |
|
63
|
|
|
'active' => false, |
|
64
|
|
|
], |
|
65
|
|
|
]; |
|
66
|
|
|
|
|
67
|
|
|
View::share([ |
|
68
|
|
|
'sub_menu' => $this->subMenu, |
|
69
|
|
|
'sub_title' => trans_choice('dashboard.moments.moments', 2), |
|
70
|
|
|
]); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function index() |
|
74
|
|
|
{ |
|
75
|
|
|
$moments = Moment::recent()->get(); |
|
|
|
|
|
|
76
|
|
|
$this->subMenu['moments']['active'] = true; |
|
77
|
|
|
|
|
78
|
|
|
return View::make('dashboard.moments.index') |
|
79
|
|
|
->withPageTitle('Moments') |
|
80
|
|
|
->withMoments($moments) |
|
81
|
|
|
->withSubMenu($this->subMenu); |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.