Completed
Pull Request — master (#70)
by Phecho
05:23 queued 10s
created

IssueController::createIssueAction()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 25
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 25
rs 8.8571
cc 2
eloc 20
nc 2
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 IssueController 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
            'issues' => [
39
                'title'  => trans('dashboard.issues.all'),
40
                'url'    => route('dashboard.issues.index'),
41
                'icon'   => 'fa fa-exclamation-circle',
42
                'active' => true,
43
            ],
44
        ];
45
46
        View::share('sub_menu', $this->subMenu);
47
        View::share('sub_title', trans('dashboard.issues.title'));
48
    }
49
50
    /**
51
     * Shows the issues view.
52
     *
53
     * @return \Illuminate\View\View
54
     */
55
    public function indexAction()
56
    {
57
        $issues = Issue::orderBy('created_at', 'desc')->get();
58
59
        return View::make('dashboard.issues.index')
60
            ->withPageTitle(trans('dashboard.issues.issues').' - '.trans('dashboard.dashboard'))
61
            ->withIssues($issues);
62
    }
63
}
64