MomentsController::indexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4286
cc 1
eloc 7
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\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