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\Providers; |
13
|
|
|
|
14
|
|
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
15
|
|
|
use Illuminate\Routing\Router; |
16
|
|
|
|
17
|
|
|
class RouteServiceProvider extends ServiceProvider |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* This namespace is applied to the controller routes in your routes file. |
21
|
|
|
* |
22
|
|
|
* In addition, it is set as the URL generator's root namespace. |
23
|
|
|
* |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
protected $namespace = 'Gitamin\Http\Controllers'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Define the route model bindings, pattern filters, etc. |
30
|
|
|
* |
31
|
|
|
* @param \Illuminate\Routing\Router $router |
32
|
|
|
*/ |
33
|
|
|
public function boot(Router $router) |
34
|
|
|
{ |
35
|
|
|
parent::boot($router); |
36
|
|
|
|
37
|
|
|
$this->registerBindings(); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Register model bindings. |
42
|
|
|
*/ |
43
|
|
|
protected function registerBindings() |
44
|
|
|
{ |
45
|
|
|
$this->app->router->model('owner', 'Gitamin\Models\Owner'); |
|
|
|
|
46
|
|
|
$this->app->router->model('project', 'Gitamin\Models\Project'); |
|
|
|
|
47
|
|
|
$this->app->router->model('issue', 'Gitamin\Models\Issue'); |
|
|
|
|
48
|
|
|
$this->app->router->model('comment', 'Gitamin\Models\Comment'); |
|
|
|
|
49
|
|
|
$this->app->router->model('setting', 'Gitamin\Models\Setting'); |
|
|
|
|
50
|
|
|
$this->app->router->model('subscriber', 'Gitamin\Models\Subscriber'); |
|
|
|
|
51
|
|
|
$this->app->router->model('user', 'Gitamin\Models\User'); |
|
|
|
|
52
|
|
|
$this->app->router->model('role', 'Gitamin\Models\Role'); |
|
|
|
|
53
|
|
|
$this->app->router->model('permission', 'Gitamin\Models\Permission'); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Define the routes for the application. |
58
|
|
|
* |
59
|
|
|
* @param \Illuminate\Routing\Router $router |
60
|
|
|
*/ |
61
|
|
|
public function map(Router $router) |
62
|
|
|
{ |
63
|
|
|
$router->group(['namespace' => $this->namespace], function (Router $router) { |
64
|
|
|
foreach (glob(app_path('Http//Routes').'/*.php') as $file) { |
65
|
|
|
$this->app->make('Gitamin\\Http\\Routes\\'.basename($file, '.php'))->map($router); |
66
|
|
|
} |
67
|
|
|
}); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: