|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: Mark |
|
5
|
|
|
* Date: 28/01/2017 |
|
6
|
|
|
* Time: 03:33. |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace App\Http\Middleware; |
|
10
|
|
|
|
|
11
|
|
|
use Closure; |
|
12
|
|
|
use App\Model\Plugin; |
|
13
|
|
|
use Illuminate\Routing\Router; |
|
14
|
|
|
use App\Classes\Interfaces\RouteableInterface; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class SettingsProvider. |
|
18
|
|
|
*/ |
|
19
|
|
|
class RouteProvider |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Handle an incoming request. |
|
23
|
|
|
* |
|
24
|
|
|
* @param \Illuminate\Http\Request $request |
|
25
|
|
|
* @param string|null $guard |
|
26
|
|
|
* @return mixed |
|
27
|
|
|
*/ |
|
28
|
|
|
public function handle($request, Closure $next, $guard = null) |
|
|
|
|
|
|
29
|
|
|
{ |
|
30
|
|
|
$router = app('router'); |
|
31
|
|
|
|
|
32
|
|
|
/** @var Plugin $plugin */ |
|
33
|
|
|
foreach (plugins()->enabled() as $plugin) { |
|
34
|
|
|
// does not require authentication. |
|
35
|
|
|
if ($plugin->isFrontEnd() && userPluginController($plugin->name()) instanceof RouteableInterface) { |
|
|
|
|
|
|
36
|
|
|
$this->loadPluginRoutes(userPluginController($plugin->name(), null, false), $router); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
// requires authentication |
|
40
|
|
|
if ($plugin->isBackEnd() && adminPluginController($plugin->name()) instanceof RouteableInterface) { |
|
|
|
|
|
|
41
|
|
|
$this->loadPluginRoutes(adminPluginController($plugin->name(), null, false), $router); |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
return $next($request); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Load the plugin controller route method. |
|
50
|
|
|
* Since plugin routes need to exist on boot. |
|
51
|
|
|
* For people to use no matter what page they |
|
52
|
|
|
* are in. |
|
53
|
|
|
* |
|
54
|
|
|
* @param RouteableInterface $plugin |
|
55
|
|
|
* @param Router $withRouter |
|
56
|
|
|
*/ |
|
57
|
|
|
private function loadPluginRoutes(RouteableInterface $plugin, Router $withRouter) |
|
58
|
|
|
{ |
|
59
|
|
|
$plugin->routes($withRouter); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths