|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* NOTICE OF LICENSE |
|
5
|
|
|
* |
|
6
|
|
|
* Part of the Cortex Fort Module. |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to The MIT License (MIT) |
|
9
|
|
|
* that is bundled with this package in the LICENSE file. |
|
10
|
|
|
* |
|
11
|
|
|
* Package: Cortex Fort Module |
|
12
|
|
|
* License: The MIT License (MIT) |
|
13
|
|
|
* Link: https://rinvex.com |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
declare(strict_types=1); |
|
17
|
|
|
|
|
18
|
|
|
namespace Cortex\Fort\Providers; |
|
19
|
|
|
|
|
20
|
|
|
use Illuminate\Routing\Router; |
|
21
|
|
|
use Illuminate\Support\ServiceProvider; |
|
22
|
|
|
|
|
23
|
|
|
class FortServiceProvider extends ServiceProvider |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* Bootstrap any application services. |
|
27
|
|
|
* |
|
28
|
|
|
* @return void |
|
29
|
|
|
*/ |
|
30
|
|
|
public function boot(Router $router) |
|
31
|
|
|
{ |
|
32
|
|
|
// Load routes |
|
33
|
|
|
$this->loadRoutes($router); |
|
34
|
|
|
|
|
35
|
|
|
if ($this->app->runningInConsole()) { |
|
36
|
|
|
// Publish Resources |
|
37
|
|
|
$this->publishResources(); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
// Register a view file namespace |
|
41
|
|
|
$this->loadViewsFrom(__DIR__.'/../../resources/views', 'cortex/fort'); |
|
42
|
|
|
|
|
43
|
|
|
// Load language phrases |
|
44
|
|
|
$this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'cortex/fort'); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Register any application services. |
|
49
|
|
|
* |
|
50
|
|
|
* This service provider is a great spot to register your various container |
|
51
|
|
|
* bindings with the application. As you can see, we are registering our |
|
52
|
|
|
* "Registrar" implementation here. You can add your own bindings too! |
|
53
|
|
|
* |
|
54
|
|
|
* @return void |
|
55
|
|
|
*/ |
|
56
|
|
|
public function register() |
|
57
|
|
|
{ |
|
58
|
|
|
// |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Load the module routes. |
|
63
|
|
|
* |
|
64
|
|
|
* @param \Illuminate\Routing\Router $router |
|
65
|
|
|
* |
|
66
|
|
|
* @return void |
|
67
|
|
|
*/ |
|
68
|
|
|
public function loadRoutes(Router $router) |
|
69
|
|
|
{ |
|
70
|
|
|
// Load routes |
|
71
|
|
|
if ($this->app->routesAreCached()) { |
|
72
|
|
|
$this->app->booted(function () { |
|
73
|
|
|
require $this->app->getCachedRoutesPath(); |
|
74
|
|
|
}); |
|
75
|
|
|
} else { |
|
76
|
|
|
// Load the application routes |
|
77
|
|
|
$router->namespace('Cortex\Fort\Http\Controllers') |
|
|
|
|
|
|
78
|
|
|
->prefix($this->app['config']['rinvex.cortex.route.locale_prefix'] ? '{locale}' : '') |
|
79
|
|
|
->middleware('web') |
|
80
|
|
|
->group(__DIR__.'/../../routes/web.php'); |
|
81
|
|
|
|
|
82
|
|
|
$this->app->booted(function () use ($router) { |
|
83
|
|
|
$router->getRoutes()->refreshNameLookups(); |
|
84
|
|
|
}); |
|
85
|
|
|
} |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Publish resources. |
|
90
|
|
|
* |
|
91
|
|
|
* @return void |
|
92
|
|
|
*/ |
|
93
|
|
|
protected function publishResources() |
|
94
|
|
|
{ |
|
95
|
|
|
// Publish views |
|
96
|
|
|
$this->publishes([ |
|
97
|
|
|
realpath(__DIR__.'/../../resources/views') => resource_path('views/vendor/cortex/fort'), |
|
98
|
|
|
], 'views'); |
|
99
|
|
|
|
|
100
|
|
|
// Publish language phrases |
|
101
|
|
|
$this->publishes([ |
|
102
|
|
|
realpath(__DIR__.'/../../resources/lang') => resource_path('lang/vendor/cortex/fort'), |
|
103
|
|
|
], 'lang'); |
|
104
|
|
|
} |
|
105
|
|
|
} |
|
106
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.