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

MomentController::indexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
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 MomentController 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
     * @return void
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...
37
     */
38
    public function __construct()
39
    {
40
        $this->subMenu = [
41
            'moments' => [
42
                'title'  => trans('dashboard.projects.yours'),
43
                'url'    => route('dashboard.moments.index'),
44
                'icon'   => 'fa fa-sliders',
45
                'active' => false,
46
            ],
47
            'project_update' => [
48
                'title'  => trans('dashboard.projects.starred'),
49
                'url'    => route('dashboard.moments.index'),
50
                'icon'   => 'fa fa-edit',
51
                'active' => false,
52
            ],
53
        ];
54
55
        View::share([
56
            'sub_menu'  => $this->subMenu,
57
            'sub_title' => trans_choice('dashboard.moments.moments', 2),
58
        ]);
59
    }
60
61
    public function indexAction()
62
    {
63
        $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...
64
        $this->subMenu['moments']['active'] = true;
65
66
        return View::make('dashboard.moments.index')
67
            ->withPageTitle('Moments')
68
            ->withMoments($moments)
69
            ->withSubMenu($this->subMenu);
70
    }
71
}
72