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\Routes; |
13
|
|
|
|
14
|
|
|
use Illuminate\Contracts\Routing\Registrar; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* This is the dashboard routes class. |
18
|
|
|
*/ |
19
|
|
|
class DashboardRoutes |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Define the dashboard routes. |
23
|
|
|
* |
24
|
|
|
* @param \Illuminate\Contracts\Routing\Registrar $router |
25
|
|
|
*/ |
26
|
|
|
public function map(Registrar $router) |
27
|
|
|
{ |
28
|
|
|
//Dashboard area |
29
|
|
|
$router->group([ |
30
|
|
|
'middleware' => 'auth', |
31
|
|
|
'prefix' => 'dashboard', |
32
|
|
|
'namespace' => 'Dashboard', |
33
|
|
|
'as' => 'dashboard.', |
34
|
|
|
], function ($router) { |
35
|
|
|
|
36
|
|
|
// Projects |
37
|
|
|
$router->group([ |
38
|
|
|
'as' => 'projects.', |
39
|
|
|
'prefix' => 'projects', |
40
|
|
View Code Duplication |
], function ($router) { |
|
|
|
|
41
|
|
|
$router->get('/', [ |
42
|
|
|
'as' => 'index', |
43
|
|
|
'uses' => 'ProjectsController@indexAction', |
44
|
|
|
]); |
45
|
|
|
$router->get('starred', [ |
46
|
|
|
'as' => 'starred', |
47
|
|
|
'uses' => 'ProjectsController@starredAction', |
48
|
|
|
]); |
49
|
|
|
}); |
50
|
|
|
|
51
|
|
|
//Groups |
52
|
|
|
$router->group([ |
53
|
|
|
'as' => 'groups.', |
54
|
|
|
'prefix' => 'groups', |
55
|
|
|
], function ($router) { |
56
|
|
|
$router->get('/', [ |
57
|
|
|
'as' => 'index', |
58
|
|
|
'uses' => 'GroupsController@indexAction', |
59
|
|
|
]); |
60
|
|
|
|
61
|
|
|
}); |
62
|
|
|
|
63
|
|
|
// Moments |
64
|
|
|
$router->group([ |
65
|
|
|
'as' => 'moments.', |
66
|
|
|
'prefix' => 'moments', |
67
|
|
|
], function ($router) { |
68
|
|
|
$router->get('/', [ |
69
|
|
|
'as' => 'index', |
70
|
|
|
'uses' => 'MomentsController@indexAction', |
71
|
|
|
]); |
72
|
|
|
}); |
73
|
|
|
|
74
|
|
|
// Milestones |
75
|
|
|
$router->group([ |
76
|
|
|
'as' => 'milestones.', |
77
|
|
|
'prefix' => 'milestones', |
78
|
|
|
], function ($router) { |
79
|
|
|
$router->get('/', [ |
80
|
|
|
'as' => 'index', |
81
|
|
|
'uses' => 'MilestonesController@indexAction', |
82
|
|
|
]); |
83
|
|
|
}); |
84
|
|
|
|
85
|
|
|
// Pull Requests |
86
|
|
|
$router->group([ |
87
|
|
|
'as' => 'pull_requests.', |
88
|
|
|
'prefix' => 'pull_requests', |
89
|
|
|
], function ($router) { |
90
|
|
|
$router->get('/', [ |
91
|
|
|
'as' => 'index', |
92
|
|
|
'uses' => 'PullRequestsController@indexAction', |
93
|
|
|
]); |
94
|
|
|
}); |
95
|
|
|
|
96
|
|
|
// Snippets |
97
|
|
|
$router->group([ |
98
|
|
|
'as' => 'snippets.', |
99
|
|
|
'prefix' => 'snippets', |
100
|
|
|
], function ($router) { |
101
|
|
|
$router->get('/', [ |
102
|
|
|
'as' => 'index', |
103
|
|
|
'uses' => 'SnippetsController@indexAction', |
104
|
|
|
]); |
105
|
|
|
}); |
106
|
|
|
|
107
|
|
|
// Issues |
108
|
|
|
$router->group([ |
109
|
|
|
'as' => 'issues.', |
110
|
|
|
'prefix' => 'issues', |
111
|
|
|
], function ($router) { |
112
|
|
|
$router->get('/', [ |
113
|
|
|
'as' => 'index', |
114
|
|
|
'uses' => 'IssuesController@indexAction', |
115
|
|
|
]); |
116
|
|
|
}); |
117
|
|
|
|
118
|
|
|
// Subscribers |
119
|
|
|
$router->group([ |
120
|
|
|
'as' => 'subscribers.', |
121
|
|
|
'prefix' => 'subscribers', |
122
|
|
|
], function ($router) { |
123
|
|
|
$router->get('/', [ |
124
|
|
|
'as' => 'index', |
125
|
|
|
'uses' => 'SubscriberController@indexAction', |
126
|
|
|
]); |
127
|
|
|
$router->get('add', [ |
128
|
|
|
'as' => 'add', |
129
|
|
|
'uses' => 'SubscriberController@showAddSubscriber', |
130
|
|
|
]); |
131
|
|
|
$router->post('add', 'SubscriberController@createSubscriberAction'); |
132
|
|
|
$router->delete('{subscriber}/delete', 'SubscriberController@deleteSubscriberAction'); |
133
|
|
|
}); |
134
|
|
|
|
135
|
|
|
// Group Members |
136
|
|
|
$router->group([ |
137
|
|
|
'as' => 'group.', |
138
|
|
|
'prefix' => 'group', |
139
|
|
|
], function ($router) { |
140
|
|
|
$router->get('/', [ |
141
|
|
|
'as' => 'index', |
142
|
|
|
'uses' => 'GroupController@showGroupView', |
143
|
|
|
]); |
144
|
|
|
|
145
|
|
|
$router->group(['middleware' => 'admin'], function ($router) { |
146
|
|
|
$router->get('add', [ |
147
|
|
|
'as' => 'add', |
148
|
|
|
'uses' => 'GroupController@showAddGroupMemberView', |
149
|
|
|
]); |
150
|
|
|
$router->get('invite', [ |
151
|
|
|
'as' => 'invite', |
152
|
|
|
'uses' => 'GroupController@showInviteGroupMemberView', |
153
|
|
|
]); |
154
|
|
|
$router->get('{user}', 'GroupController@showGroupMemberView'); |
155
|
|
|
$router->post('add', 'GroupController@postAddUser'); |
156
|
|
|
$router->post('invite', 'GroupController@postInviteUser'); |
157
|
|
|
$router->post('{user}', 'GroupController@postUpdateUser'); |
158
|
|
|
$router->delete('{user}/delete', 'GroupController@deleteUser'); |
159
|
|
|
}); |
160
|
|
|
}); |
161
|
|
|
|
162
|
|
|
// User Settings |
163
|
|
|
$router->group(['prefix' => 'user'], function ($router) { |
164
|
|
|
$router->get('/', [ |
165
|
|
|
'as' => 'user', |
166
|
|
|
'uses' => 'UserController@showUser', |
167
|
|
|
]); |
168
|
|
|
$router->post('/', 'UserController@postUser'); |
169
|
|
|
$router->get('{user}/api/regen', 'UserController@regenerateApiKey'); |
170
|
|
|
}); |
171
|
|
|
|
172
|
|
|
/* |
173
|
|
|
* Internal API. |
174
|
|
|
* This should only be used for making requests within the dashboard. |
175
|
|
|
*/ |
176
|
|
|
$router->group(['prefix' => 'api'], function ($router) { |
177
|
|
|
$router->post('projects/order', 'ApiController@postUpdateProjectOrder'); |
178
|
|
|
$router->post('projects/{project}', 'ApiController@postUpdateProject'); |
179
|
|
|
//$router->post('upload/avatar', 'Phecho\\Uploader\\UploaderController@index'); |
|
|
|
|
180
|
|
|
}); |
181
|
|
|
}); |
182
|
|
|
} |
183
|
|
|
} |
184
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.