1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace MohsenAbrishami\Stethoscope; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use MohsenAbrishami\Stethoscope\Commands\CleanupCommand; |
7
|
|
|
use MohsenAbrishami\Stethoscope\Commands\ListenCommand; |
8
|
|
|
use MohsenAbrishami\Stethoscope\Commands\MonitorCommand; |
9
|
|
|
use MohsenAbrishami\Stethoscope\Http\Middleware\CheckAccessToMonitoringPanel; |
10
|
|
|
use MohsenAbrishami\Stethoscope\LogRecord\LogManager; |
11
|
|
|
use MohsenAbrishami\Stethoscope\Providers\EventServiceProvider; |
12
|
|
|
|
13
|
|
|
class StethoscopeServiceProvider extends ServiceProvider |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* Register any application services. |
17
|
|
|
* |
18
|
|
|
* @return void |
19
|
|
|
*/ |
20
|
|
|
public function register() |
21
|
|
|
{ |
22
|
|
|
$this->app->singleton('record', function ($app) { |
23
|
|
|
return new LogManager($app); |
24
|
|
|
}); |
25
|
|
|
|
26
|
|
|
$this->mergeConfigFrom( |
27
|
|
|
__DIR__.'/../config/stethoscope.php', |
28
|
|
|
'stethoscope' |
29
|
|
|
); |
30
|
|
|
|
31
|
|
|
$this->app->register(EventServiceProvider::class); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Bootstrap any package services. |
36
|
|
|
* |
37
|
|
|
* @return void |
38
|
|
|
*/ |
39
|
|
|
public function boot() |
40
|
|
|
{ |
41
|
|
|
if ($this->app->runningInConsole()) { |
42
|
|
|
// publishing the config |
43
|
|
|
$this->publishes([ |
44
|
|
|
__DIR__.'/../config/stethoscope.php' => config_path('stethoscope.php'), |
45
|
|
|
], 'stethoscope-publish-config'); |
46
|
|
|
|
47
|
|
|
// publishing the build files |
48
|
|
|
$this->publishes([ |
49
|
|
|
__DIR__.'/../public/build' => public_path('vendor/stethoscope'), |
50
|
|
|
], 'stethoscope-publish-view'); |
51
|
|
|
|
52
|
|
|
$this->commands([ |
53
|
|
|
ListenCommand::class, |
54
|
|
|
MonitorCommand::class, |
55
|
|
|
CleanupCommand::class, |
56
|
|
|
]); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
60
|
|
|
|
61
|
|
|
$this->loadRoutesFrom(__DIR__.'/../routes/api.php'); |
62
|
|
|
$this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
63
|
|
|
|
64
|
|
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'mohsenabrishami'); |
65
|
|
|
|
66
|
|
|
$this->app['router']->aliasMiddleware('check.access.to.monitoring.panel', CheckAccessToMonitoringPanel::class); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|