Completed
Pull Request — master (#74)
by Phecho
05:50
created

IssuesController::__construct()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 26
rs 8.8571
cc 1
eloc 19
nc 1
nop 0
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
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

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.

Loading history...
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