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
|
|
|
|
74
|
|
|
|
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|