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 projects routes class. |
18
|
|
|
*/ |
19
|
|
|
class ProjectsRoutes |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Define the projects routes. |
23
|
|
|
* |
24
|
|
|
* @param \Illuminate\Contracts\Routing\Registrar $router |
25
|
|
|
*/ |
26
|
|
|
public function map(Registrar $router) |
27
|
|
|
{ |
28
|
|
|
|
29
|
|
|
// Project Area |
30
|
|
|
$router->group([ |
31
|
|
|
'middleware' => ['app.hasSetting'], |
32
|
|
|
'setting' => 'app_name', |
33
|
|
|
'prefix' => 'projects', |
34
|
|
|
'as' => 'projects.', |
35
|
|
|
], function ($router) { |
36
|
|
|
$router->get('/', [ |
37
|
|
|
'as' => 'index', |
38
|
|
|
'uses' => 'ProjectsController@index', |
39
|
|
|
]); |
40
|
|
|
$router->get('new', [ |
41
|
|
|
'as' => 'new', |
42
|
|
|
'uses' => 'ProjectsController@new', |
43
|
|
|
]); |
44
|
|
|
$router->post('create', [ |
45
|
|
|
'as' => 'create', |
46
|
|
|
'uses' => 'ProjectsController@create', |
47
|
|
|
]); |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
}); |
51
|
|
|
|
52
|
|
|
// Project Sub-routes |
53
|
|
|
$router->group([ |
54
|
|
|
'middleware' => ['app.hasSetting'], |
55
|
|
|
'setting' => 'app_name', |
56
|
|
|
'as' => 'projects.', |
57
|
|
|
], function ($router) { |
58
|
|
|
$router->get('{namespace}/{project}', [ |
59
|
|
|
'as' => 'project_show', |
60
|
|
|
'uses' => 'ProjectsController@show', |
61
|
|
|
])->where('namespace', '[a-zA-z.0-9_\-]+')->where('project', '[a-zA-z.0-9_\-]+'); |
62
|
|
|
|
63
|
|
|
$router->get('{namespace}/{project}/edit', [ |
64
|
|
|
'as' => 'project_edit', |
65
|
|
|
'uses' => 'ProjectsController@edit', |
66
|
|
|
])->where('namespace', '[a-zA-z.0-9_\-]+')->where('project', '[a-zA-z.0-9_\-]+'); |
67
|
|
|
$router->post('{namespace}/{project}/update', [ |
68
|
|
|
'as' => 'project_update', |
69
|
|
|
'uses' => 'ProjectsController@update', |
70
|
|
|
])->where('namespace', '[a-zA-z.0-9_\-]+')->where('project', '[a-zA-z.0-9_\-]+'); |
71
|
|
|
|
72
|
|
|
|
73
|
|
|
//Issues |
74
|
|
|
$router->get('{namespace}/{project}/issues', [ |
75
|
|
|
'as' => 'issue_index', |
76
|
|
|
'uses' => 'Projects\\IssuesController@index', |
77
|
|
|
])->where('namespace', '[a-zA-z.0-9_\-]+')->where('project', '[a-zA-z.0-9_\-]+'); |
78
|
|
|
|
79
|
|
|
//new |
80
|
|
|
$router->get('{namespace}/{project}/issues/new', [ |
81
|
|
|
'as' => 'issue_new', |
82
|
|
|
'uses' => 'Projects\\IssuesController@new', |
83
|
|
|
])->where('namespace', '[a-zA-z.0-9_\-]+')->where('project', '[a-zA-z.0-9_\-]+'); |
84
|
|
|
|
85
|
|
|
//create |
86
|
|
|
$router->post('{namespace}/{project}/issues', [ |
87
|
|
|
'as' => 'issue_create', |
88
|
|
|
'uses' => 'Projects\\IssuesController@create', |
89
|
|
|
])->where('namespace', '[a-zA-z.0-9_\-]+')->where('project', '[a-zA-z.0-9_\-]+'); |
90
|
|
|
|
91
|
|
|
//show |
92
|
|
|
$router->get('{namespace}/{project}/issues/{issue}', [ |
93
|
|
|
'as' => 'issue_show', |
94
|
|
|
'uses' => 'Projects\\IssuesController@show', |
95
|
|
|
])->where('namespace', '[a-zA-z.0-9_\-]+')->where('project', '[a-zA-z.0-9_\-]+'); |
96
|
|
|
|
97
|
|
|
//update |
98
|
|
|
$router->post('{namespace}/{project}/issues/{issue}', [ |
99
|
|
|
'as' => 'issue_update', |
100
|
|
|
'uses' => 'Projects\\IssuesController@update', |
101
|
|
|
])->where('namespace', '[a-zA-z.0-9_\-]+')->where('project', '[a-zA-z.0-9_\-]+'); |
102
|
|
|
|
103
|
|
|
}); |
104
|
|
|
|
105
|
|
|
|
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|