1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sco\Admin\Providers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
|
7
|
|
|
class ResourcesServiceProvider extends ServiceProvider |
8
|
|
|
{ |
9
|
|
|
public function getBasePath() |
10
|
|
|
{ |
11
|
|
|
return dirname(dirname(__DIR__)); |
12
|
|
|
} |
13
|
|
|
|
14
|
|
|
public function boot() |
15
|
|
|
{ |
16
|
|
|
//$this->loadRoutes(); |
|
|
|
|
17
|
|
|
|
18
|
|
|
$this->loadViewsFrom( |
19
|
|
|
$this->getBasePath() . '/resources/views', |
20
|
|
|
'admin' |
21
|
|
|
); |
22
|
|
|
|
23
|
|
|
$this->loadTranslationsFrom( |
24
|
|
|
$this->getBasePath() . '/resources/lang', |
25
|
|
|
'admin' |
26
|
|
|
); |
27
|
|
|
|
28
|
|
|
if ($this->app->runningInConsole()) { |
29
|
|
|
$this->publishAssets(); |
30
|
|
|
$this->publishConfig(); |
31
|
|
|
$this->publishViews(); |
32
|
|
|
$this->publishTranslations(); |
33
|
|
|
//$this->publishRoutes(); |
|
|
|
|
34
|
|
|
} |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function register() |
38
|
|
|
{ |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
protected function publishAssets() |
42
|
|
|
{ |
43
|
|
|
$this->publishes([ |
44
|
|
|
$this->getBasePath() . '/resources/assets' => base_path('resources/assets/vendor/admin'), |
45
|
|
|
], 'assets'); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
protected function publishConfig() |
49
|
|
|
{ |
50
|
|
|
$this->publishes([ |
51
|
|
|
$this->getBasePath() . '/config/' => config_path(), |
52
|
|
|
], 'config'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
protected function publishViews() |
56
|
|
|
{ |
57
|
|
|
$this->publishes([ |
58
|
|
|
$this->getBasePath() . '/resources/views' => base_path('resources/views/vendor/admin'), |
59
|
|
|
], 'views'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
protected function publishTranslations() |
63
|
|
|
{ |
64
|
|
|
$this->publishes([ |
65
|
|
|
$this->getBasePath() . '/resources/lang' => base_path('resources/lang/vendor/admin'), |
66
|
|
|
], 'lang'); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/*protected function publishRoutes() |
|
|
|
|
70
|
|
|
{ |
71
|
|
|
$this->publishes([ |
72
|
|
|
$this->getBasePath() . '/routes/admin.php' => base_path('routes/admin.php'), |
73
|
|
|
], 'routes'); |
74
|
|
|
}*/ |
75
|
|
|
|
76
|
|
|
/*protected function loadRoutes() |
|
|
|
|
77
|
|
|
{ |
78
|
|
|
$routesFile = $this->getBasePath() . '/routes/admin.php'; |
79
|
|
|
$this->loadRoutesFrom($routesFile); |
80
|
|
|
}*/ |
81
|
|
|
} |
82
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.