1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Acacha\AdminLTETemplateLaravel\Providers; |
4
|
|
|
|
5
|
|
|
use Acacha\AdminLTETemplateLaravel\Facades\AdminLTE; |
6
|
|
|
use Illuminate\Console\AppNamespaceDetectorTrait; |
7
|
|
|
use Illuminate\Support\ServiceProvider; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class AdminLTETemplateServiceProvider. |
11
|
|
|
*/ |
12
|
|
|
class AdminLTETemplateServiceProvider extends ServiceProvider |
13
|
|
|
{ |
14
|
|
|
use AppNamespaceDetectorTrait; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Register the application services. |
18
|
|
|
*/ |
19
|
|
|
public function register() |
20
|
|
|
{ |
21
|
|
|
if (!defined('ADMINLTETEMPLATE_PATH')) { |
22
|
|
|
define('ADMINLTETEMPLATE_PATH', realpath(__DIR__.'/../../')); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
if ($this->app->runningInConsole()) { |
|
|
|
|
26
|
|
|
$this->commands([\Acacha\AdminLTETemplateLaravel\Console\AdminLTE::class]); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
$this->app->bind('AdminLTE', function () { |
30
|
|
|
return new \Acacha\AdminLTETemplateLaravel\AdminLTE(); |
31
|
|
|
}); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Bootstrap the application services. |
36
|
|
|
*/ |
37
|
|
|
public function boot() |
38
|
|
|
{ |
39
|
|
|
$this->defineRoutes(); |
40
|
|
|
$this->publishHomeController(); |
41
|
|
|
$this->changeAuthController(); |
42
|
|
|
$this->publishPublicAssets(); |
43
|
|
|
$this->publishViews(); |
44
|
|
|
$this->publishResourceAssets(); |
45
|
|
|
$this->publishTests(); |
46
|
|
|
$this->publishLanguages(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Define the AdminLTETemplate routes. |
51
|
|
|
*/ |
52
|
|
|
protected function defineRoutes() |
53
|
|
|
{ |
54
|
|
|
if (!$this->app->routesAreCached()) { |
|
|
|
|
55
|
|
|
$router = app('router'); |
56
|
|
|
|
57
|
|
|
$router->group(['namespace' => $this->getAppNamespace().'Http\Controllers'], function () { |
58
|
|
|
require __DIR__.'/../Http/routes.php'; |
59
|
|
|
}); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Publish Home Controller. |
65
|
|
|
*/ |
66
|
|
|
private function publishHomeController() |
67
|
|
|
{ |
68
|
|
|
$this->publishes(AdminLTE::homeController(), 'adminlte'); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Change default Laravel AuthController. |
73
|
|
|
*/ |
74
|
|
|
private function changeAuthController() |
75
|
|
|
{ |
76
|
|
|
$this->publishes(AdminLTE::authController(), 'adminlte'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Publish public resource assets to Laravel project. |
81
|
|
|
*/ |
82
|
|
|
private function publishPublicAssets() |
83
|
|
|
{ |
84
|
|
|
$this->publishes(AdminLTE::publicAssets(), 'adminlte'); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Publish package views to Laravel project. |
89
|
|
|
*/ |
90
|
|
|
private function publishViews() |
91
|
|
|
{ |
92
|
|
|
$this->loadViewsFrom(ADMINLTETEMPLATE_PATH.'/resources/views/', 'adminlte'); |
93
|
|
|
|
94
|
|
|
$this->publishes(AdminLTE::views(), 'adminlte'); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Publish package resource assets to Laravel project. |
99
|
|
|
*/ |
100
|
|
|
private function publishResourceAssets() |
101
|
|
|
{ |
102
|
|
|
$this->publishes(AdminLTE::resourceAssets(), 'adminlte'); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Publish package tests to Laravel project. |
107
|
|
|
*/ |
108
|
|
|
private function publishTests() |
109
|
|
|
{ |
110
|
|
|
$this->publishes(AdminLTE::tests(), 'adminlte'); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Publish package language to Laravel project. |
115
|
|
|
*/ |
116
|
|
|
private function publishLanguages() |
117
|
|
|
{ |
118
|
|
|
$this->loadTranslationsFrom(ADMINLTETEMPLATE_PATH.'/resources/lang/', 'adminlte_lang'); |
119
|
|
|
|
120
|
|
|
$this->publishes([ |
121
|
|
|
ADMINLTETEMPLATE_PATH.'/resources/lang/' => resource_path('lang/vendor/adminlte_lang'), |
122
|
|
|
]); |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.