Completed
Pull Request — master (#70)
by Phecho
03:24
created

IssueController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 10
Bugs 5 Features 2
Metric Value
wmc 2
c 10
b 5
f 2
lcom 0
cbo 2
dl 0
loc 45
rs 10

2 Methods

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