MomentsController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 22 1
A indexAction() 0 10 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 Gitamin\Models\Moment;
15
use Illuminate\Routing\Controller;
16
use Illuminate\Support\Facades\View;
17
18
class MomentsController 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
    public function __construct()
37
    {
38
        $this->subMenu = [
39
            'moments' => [
40
                'title' => trans('dashboard.projects.yours'),
41
                'url' => route('dashboard.moments.index'),
42
                'icon' => 'fa fa-sliders',
43
                'active' => false,
44
            ],
45
            'project_update' => [
46
                'title' => trans('dashboard.projects.starred'),
47
                'url' => route('dashboard.moments.index'),
48
                'icon' => 'fa fa-edit',
49
                'active' => false,
50
            ],
51
        ];
52
53
        View::share([
54
            'sub_menu' => $this->subMenu,
55
            'sub_title' => trans_choice('dashboard.moments.moments', 2),
56
        ]);
57
    }
58
59
    public function indexAction()
60
    {
61
        $moments = Moment::recent()->get();
0 ignored issues
show
Bug introduced by
The method recent() does not exist on Gitamin\Models\Moment. Did you maybe mean scopeRecent()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
62
        $this->subMenu['moments']['active'] = true;
63
64
        return View::make('dashboard.moments.index')
65
            ->withPageTitle('Moments')
66
            ->withMoments($moments)
67
            ->withSubMenu($this->subMenu);
68
    }
69
}
70