1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace LaravelFlare\Flare\Providers; |
4
|
|
|
|
5
|
|
|
use Route; |
6
|
|
|
use Illuminate\Routing\Router; |
7
|
|
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
8
|
|
|
|
9
|
|
|
class RouteServiceProvider extends ServiceProvider |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* This namespace is applied to the controller routes in your routes file. |
13
|
|
|
* |
14
|
|
|
* In addition, it is set as the URL generator's root namespace. |
15
|
|
|
* |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
protected $namespace = '\LaravelFlare\Flare\Http\Controllers'; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Define your route model bindings, pattern filters, etc. |
22
|
|
|
* |
23
|
|
|
* @param \Illuminate\Routing\Router $router |
24
|
|
|
*/ |
25
|
|
|
public function boot(Router $router) |
26
|
|
|
{ |
27
|
|
|
// |
28
|
|
|
|
29
|
|
|
parent::boot($router); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Define the routes for the application. |
34
|
|
|
* |
35
|
|
|
* @param \Illuminate\Routing\Router $router |
36
|
|
|
*/ |
37
|
|
|
public function map(Router $router) |
38
|
|
|
{ |
39
|
|
|
$router->middleware('flareauthenticate', \LaravelFlare\Flare\Http\Middleware\FlareAuthenticate::class); |
40
|
|
|
$router->middleware('checkmodelfound', \LaravelFlare\Flare\Http\Middleware\CheckModelFound::class); |
41
|
|
|
$router->middleware('checkpermissions', \LaravelFlare\Flare\Http\Middleware\CheckPermissions::class); |
42
|
|
|
|
43
|
|
|
$router->middlewareGroup('flarebase', [ |
44
|
|
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
45
|
|
|
\Illuminate\Session\Middleware\StartSession::class, |
46
|
|
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class, |
47
|
|
|
\App\Http\Middleware\VerifyCsrfToken::class, |
48
|
|
|
\App\Http\Middleware\EncryptCookies::class, |
49
|
|
|
]); |
50
|
|
|
|
51
|
|
|
$router->middlewareGroup('flare', [ |
52
|
|
|
'flarebase', |
53
|
|
|
'flareauthenticate', |
54
|
|
|
'checkpermissions', |
55
|
|
|
]); |
56
|
|
|
|
57
|
|
|
$router->group(['prefix' => \Flare::config('admin_url'), 'namespace' => $this->namespace, 'middleware' => ['flare']], function ($router) { |
|
|
|
|
58
|
|
|
(new \LaravelFlare\Flare\Admin\AdminManager())->registerRoutes(); |
59
|
|
|
}); |
60
|
|
|
|
61
|
|
|
$router->group(['prefix' => \Flare::config('admin_url'), 'middleware' => ['flarebase']], function ($router) { |
62
|
|
|
|
63
|
|
|
// Needs replacing with implicit routes, as controller is deprecated as of 5.2 and will be removed in 5.3 |
64
|
|
|
$router->controller('/', $this->namespace . '\AdminController'); |
65
|
|
|
|
66
|
|
|
}); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.