|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Tinyissue package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Mohamed Alsharaf <[email protected]> |
|
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 Tinyissue\Providers; |
|
13
|
|
|
|
|
14
|
|
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
|
15
|
|
|
use Illuminate\Routing\Router; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* RouteServiceProvider is the route service provider for registering the application routes to controllers and actions. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Mohamed Alsharaf <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
class RouteServiceProvider extends ServiceProvider |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* This namespace is applied to the controller routes in your routes file. |
|
26
|
|
|
* |
|
27
|
|
|
* In addition, it is set as the URL generator's root namespace. |
|
28
|
|
|
* |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $namespace = 'Tinyissue\Http\Controllers'; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Define your route model bindings, pattern filters, etc. |
|
35
|
|
|
* |
|
36
|
|
|
* @param \Illuminate\Routing\Router $router |
|
37
|
|
|
*/ |
|
38
|
63 |
|
public function boot(Router $router) |
|
39
|
|
|
{ |
|
40
|
63 |
|
$router->model('project', 'Tinyissue\Model\Project'); |
|
41
|
63 |
|
$router->model('issue', 'Tinyissue\Model\Project\Issue'); |
|
42
|
63 |
|
$router->model('attachment', 'Tinyissue\Model\Project\Issue\Attachment'); |
|
43
|
63 |
|
$router->model('comment', 'Tinyissue\Model\Project\Issue\Comment'); |
|
44
|
63 |
|
$router->model('note', 'Tinyissue\Model\Project\Note'); |
|
45
|
63 |
|
$router->model('tag', 'Tinyissue\Model\Tag'); |
|
46
|
63 |
|
$router->model('user', 'Tinyissue\Model\User'); |
|
47
|
|
|
|
|
48
|
63 |
|
$router->pattern('project', '[0-9]+'); |
|
49
|
63 |
|
$router->pattern('issue', '[0-9]+'); |
|
50
|
63 |
|
$router->pattern('comment', '[0-9]+'); |
|
51
|
63 |
|
$router->pattern('issue', '[0-9]+'); |
|
52
|
63 |
|
$router->pattern('limit', '[0-9]+'); |
|
53
|
63 |
|
$router->pattern('attachment', '[0-9]+'); |
|
54
|
63 |
|
$router->pattern('note', '[0-9]+'); |
|
55
|
63 |
|
$router->pattern('term', '\w+'); |
|
56
|
63 |
|
$router->pattern('tag', '[0-9]+'); |
|
57
|
|
|
|
|
58
|
63 |
|
parent::boot($router); |
|
59
|
63 |
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Load routes for the web. |
|
63
|
|
|
* |
|
64
|
|
|
* @param Router $router |
|
65
|
|
|
* @param string $directory |
|
66
|
|
|
*/ |
|
67
|
|
|
protected function mapRoutes(Router $router, $directory) |
|
68
|
|
|
{ |
|
69
|
63 |
|
$router->group(['namespace' => $this->namespace], function (Router $router) use ($directory) { |
|
70
|
63 |
|
require base_path('routes/' . $directory . '.php'); |
|
71
|
63 |
|
}); |
|
72
|
63 |
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Define the routes for the application. |
|
76
|
|
|
* |
|
77
|
|
|
* @param Router $router |
|
78
|
|
|
*/ |
|
79
|
63 |
|
public function map(Router $router) |
|
80
|
|
|
{ |
|
81
|
63 |
|
$this->mapRoutes($router, 'web'); |
|
82
|
63 |
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|