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\Admin; |
13
|
|
|
|
14
|
|
|
use Exception; |
15
|
|
|
use Gitamin\Models\Project; |
16
|
|
|
use Gitamin\Models\Setting; |
17
|
|
|
use GrahamCampbell\Binput\Facades\Binput; |
18
|
|
|
use Illuminate\Routing\Controller; |
19
|
|
|
use Illuminate\Support\Facades\Lang; |
20
|
|
|
use Illuminate\Support\Facades\Redirect; |
21
|
|
|
use Illuminate\Support\Facades\Session; |
22
|
|
|
use Illuminate\Support\Facades\View; |
23
|
|
|
|
24
|
|
|
class DashboardController extends Controller |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Creates a new settings controller instance. |
28
|
|
|
* |
29
|
|
|
* @return void |
|
|
|
|
30
|
|
|
*/ |
31
|
|
View Code Duplication |
public function __construct() |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
$this->subMenu = [ |
|
|
|
|
34
|
|
|
'overview' => [ |
35
|
|
|
'title' => 'Overview', |
36
|
|
|
'url' => route('admin.index'), |
37
|
|
|
'icon' => 'fa fa-wrench', |
38
|
|
|
'active' => false, |
39
|
|
|
], |
40
|
|
|
'general' => [ |
41
|
|
|
'title' => trans('admin.settings.general.general'), |
42
|
|
|
'url' => route('admin.settings.general'), |
43
|
|
|
'icon' => 'fa fa-gear', |
44
|
|
|
'active' => false, |
45
|
|
|
], |
46
|
|
|
'theme' => [ |
47
|
|
|
'title' => trans('admin.settings.theme.theme'), |
48
|
|
|
'url' => route('admin.settings.theme'), |
49
|
|
|
'icon' => 'fa fa-list-alt', |
50
|
|
|
'active' => false, |
51
|
|
|
], |
52
|
|
|
'stylesheet' => [ |
53
|
|
|
'title' => trans('admin.settings.stylesheet.stylesheet'), |
54
|
|
|
'url' => route('admin.settings.stylesheet'), |
55
|
|
|
'icon' => 'fa fa-magic', |
56
|
|
|
'active' => false, |
57
|
|
|
], |
58
|
|
|
'localization' => [ |
59
|
|
|
'title' => trans('admin.settings.localization.localization'), |
60
|
|
|
'url' => route('admin.settings.localization'), |
61
|
|
|
'icon' => 'fa fa-language', |
62
|
|
|
'active' => false, |
63
|
|
|
], |
64
|
|
|
'timezone' => [ |
65
|
|
|
'title' => trans('admin.settings.timezone.timezone'), |
66
|
|
|
'url' => route('admin.settings.timezone'), |
67
|
|
|
'icon' => 'fa fa-calendar', |
68
|
|
|
'active' => false, |
69
|
|
|
], |
70
|
|
|
]; |
71
|
|
|
|
72
|
|
|
View::share([ |
73
|
|
|
'sub_title' => trans('admin.admin'), |
74
|
|
|
'sub_menu' => $this->subMenu, |
75
|
|
|
]); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Display a listing of the resource. |
80
|
|
|
* |
81
|
|
|
* @return \Illuminate\Http\Response |
82
|
|
|
*/ |
83
|
|
|
public function indexAction() |
84
|
|
|
{ |
85
|
|
|
$this->subMenu['overview']['active'] = true; |
86
|
|
|
|
87
|
|
|
Session::flash('redirect_to', $this->subMenu['general']['url']); |
88
|
|
|
|
89
|
|
|
$projects = Project::orderBy('created_at')->get(); |
|
|
|
|
90
|
|
|
|
91
|
|
|
$projects = Project::get(); |
92
|
|
|
$issues = []; |
93
|
|
|
$subscribers = []; |
94
|
|
|
|
95
|
|
|
return View::make('admin.index') |
96
|
|
|
->withPageTitle(trans('admin.admin')) |
97
|
|
|
->withProjects($projects) |
98
|
|
|
->withIssues($issues) |
99
|
|
|
->withSubscribers($subscribers) |
100
|
|
|
->withSubMenu($this->subMenu); |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|
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.