Completed
Pull Request — master (#17)
by Phecho
42:37
created

ActivityController::showActivities()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 2 Features 0
Metric Value
c 4
b 2
f 0
dl 0
loc 10
rs 9.4286
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Gitamin\Http\Controllers\Dashboard;
4
5
use Illuminate\Routing\Controller;
6
use Illuminate\Support\Facades\View;
7
8
class ActivityController extends Controller
9
{
10
    /**
11
     * Display a listing of the resource.
12
     *
13
     * @return \Illuminate\Http\Response
14
     */
15
16
    /**
17
     * Array of sub-menu items.
18
     *
19
     * @var array
20
     */
21
    protected $subMenu = [];
22
23
    /**
24
     * Creates a new activity controller instance.
25
     *
26
     * @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...
27
     */
28
    public function __construct()
29
    {
30
        $this->subMenu = [
31
            'activity' => [
32
                'title'  => trans('dashboard.activity.all'),
33
                'url'    => route('dashboard.activity.index'),
34
                'icon'   => 'fa fa-sliders',
35
                'active' => false,
36
            ],
37
            'project_update' => [
38
                'title'  => trans('dashboard.activity.project_update'),
39
                'url'    => route('dashboard.activity.index'),
40
                'icon'   => 'fa fa-edit',
41
                'active' => false,
42
            ],
43
            'topic' => [
44
                'title'  => trans('dashboard.activity.topic'),
45
                'url'    => route('dashboard.activity.index'),
46
                'icon'   => 'fa fa-comment',
47
                'active' => false,
48
            ],
49
            'watched_project' => [
50
                'title'  => trans('dashboard.activity.watched_project'),
51
                'url'    => route('dashboard.activity.index'),
52
                'icon'   => 'fa fa-eye',
53
                'active' => false,
54
            ],
55
        ];
56
57
        View::share([
58
            'sub_menu'  => $this->subMenu,
59
            'sub_title' => trans_choice('dashboard.activity.activity', 2),
60
        ]);
61
    }
62
63
    public function index()
64
    {
65
        $activities = [];
66
67
        $this->subMenu['activity']['active'] = true;
68
69
        return View::make('dashboard.activity.index')
70
            ->withPageTitle('Activity')
71
            ->withActivities($activities)
72
            ->withSubMenu($this->subMenu);
73
    }
74
}
75