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\Issue; |
15
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs; |
16
|
|
|
use Illuminate\Routing\Controller; |
17
|
|
|
use Illuminate\Support\Facades\View; |
18
|
|
|
|
19
|
|
|
class IssuesController extends Controller |
20
|
|
|
{ |
21
|
|
|
use DispatchesJobs; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Stores the sub-sidebar tree list. |
25
|
|
|
* |
26
|
|
|
* @var array |
27
|
|
|
*/ |
28
|
|
|
protected $subMenu = []; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Creates a new issue controller instance. |
32
|
|
|
* |
33
|
|
|
* @return \Gitamin\Http\Controllers\IssueController |
|
|
|
|
34
|
|
|
*/ |
35
|
|
|
public function __construct() |
36
|
|
|
{ |
37
|
|
|
$this->subMenu = [ |
38
|
|
|
'open' => [ |
39
|
|
|
'title' => trans('dashboard.issues.open'), |
40
|
|
|
'url' => route('dashboard.issues.index'), |
41
|
|
|
'icon' => 'fa fa-eye', |
42
|
|
|
'active' => true, |
43
|
|
|
], |
44
|
|
|
'closed' => [ |
45
|
|
|
'title' => trans('dashboard.issues.closed'), |
46
|
|
|
'url' => route('dashboard.issues.index'), |
47
|
|
|
'icon' => 'fa fa-close', |
48
|
|
|
'active' => false, |
49
|
|
|
], |
50
|
|
|
'all' => [ |
51
|
|
|
'title' => trans('dashboard.issues.all'), |
52
|
|
|
'url' => route('dashboard.issues.index'), |
53
|
|
|
'icon' => 'fa fa-exclamation-circle', |
54
|
|
|
'active' => false, |
55
|
|
|
], |
56
|
|
|
]; |
57
|
|
|
|
58
|
|
|
View::share('sub_menu', $this->subMenu); |
59
|
|
|
View::share('sub_title', trans('dashboard.issues.title')); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Shows the issues view. |
64
|
|
|
* |
65
|
|
|
* @return \Illuminate\View\View |
66
|
|
|
*/ |
67
|
|
|
public function indexAction() |
68
|
|
|
{ |
69
|
|
|
$issues = Issue::orderBy('created_at', 'desc')->get(); |
70
|
|
|
|
71
|
|
|
return View::make('dashboard.issues.index') |
72
|
|
|
->withPageTitle(trans('dashboard.issues.issues').' - '.trans('dashboard.dashboard')) |
73
|
|
|
->withIssues($issues); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
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.