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
|
|
View Code Duplication |
public function __construct() |
|
|
|
|
39
|
|
|
{ |
40
|
|
|
$this->subMenu = [ |
41
|
|
|
'moments' => [ |
42
|
|
|
'title' => trans('dashboard.projects.yours'), |
43
|
|
|
'url' => route('dashboard.moments.index'), |
44
|
|
|
'icon' => 'fa fa-sliders', |
45
|
|
|
'active' => false, |
46
|
|
|
], |
47
|
|
|
'project_update' => [ |
48
|
|
|
'title' => trans('dashboard.projects.starred'), |
49
|
|
|
'url' => route('dashboard.moments.index'), |
50
|
|
|
'icon' => 'fa fa-edit', |
51
|
|
|
'active' => false, |
52
|
|
|
], |
53
|
|
|
]; |
54
|
|
|
|
55
|
|
|
View::share([ |
56
|
|
|
'sub_menu' => $this->subMenu, |
57
|
|
|
'sub_title' => trans_choice('dashboard.moments.moments', 2), |
58
|
|
|
]); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function index() |
62
|
|
|
{ |
63
|
|
|
$moments = Moment::recent()->get(); |
|
|
|
|
64
|
|
|
$this->subMenu['moments']['active'] = true; |
65
|
|
|
|
66
|
|
|
return View::make('dashboard.moments.index') |
67
|
|
|
->withPageTitle('Moments') |
68
|
|
|
->withMoments($moments) |
69
|
|
|
->withSubMenu($this->subMenu); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
Adding a
@return
annotation 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.