1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Infinitypaul\LaravelUptime; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use Infinitypaul\LaravelUptime\Commands\AddEndPoint; |
7
|
|
|
use Infinitypaul\LaravelUptime\Commands\RemoveEndPoints; |
8
|
|
|
use Infinitypaul\LaravelUptime\Commands\Run; |
9
|
|
|
|
10
|
|
|
class LaravelUptimeServiceProvider extends ServiceProvider |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* Bootstrap the application services. |
14
|
|
|
*/ |
15
|
|
|
public function boot() |
16
|
|
|
{ |
17
|
|
|
/* |
18
|
|
|
* Optional methods to load your package assets |
19
|
|
|
*/ |
20
|
|
|
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'laravel-uptime'); |
21
|
|
|
// $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-uptime'); |
22
|
|
|
// $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
23
|
|
|
// $this->loadRoutesFrom(__DIR__.'/routes.php'); |
24
|
|
|
$this->publishMigration(); |
25
|
|
|
if ($this->app->runningInConsole()) { |
26
|
|
|
$this->publishes([ |
27
|
|
|
__DIR__.'/../config/config.php' => config_path('uptime.php'), |
28
|
|
|
], 'config'); |
29
|
|
|
|
30
|
|
|
// Publishing the views. |
31
|
|
|
/*$this->publishes([ |
32
|
|
|
__DIR__.'/../resources/views' => resource_path('views/vendor/laravel-uptime'), |
33
|
|
|
], 'views');*/ |
34
|
|
|
|
35
|
|
|
// Publishing assets. |
36
|
|
|
/*$this->publishes([ |
37
|
|
|
__DIR__.'/../resources/assets' => public_path('vendor/laravel-uptime'), |
38
|
|
|
], 'assets');*/ |
39
|
|
|
|
40
|
|
|
// Publishing the translation files. |
41
|
|
|
/*$this->publishes([ |
42
|
|
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/laravel-uptime'), |
43
|
|
|
], 'lang');*/ |
44
|
|
|
|
45
|
|
|
//Registering package commands. |
46
|
|
|
$this->commands([ |
47
|
|
|
AddEndPoint::class, |
48
|
|
|
Run::class, |
49
|
|
|
\Infinitypaul\LaravelUptime\Commands\Status::class, |
50
|
|
|
RemoveEndPoints::class, |
51
|
|
|
]); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Register the application services. |
57
|
|
|
*/ |
58
|
|
|
public function register() |
59
|
|
|
{ |
60
|
|
|
// Automatically apply the package configuration |
61
|
|
|
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'uptime'); |
62
|
|
|
|
63
|
|
|
// Register the main class to use with the facade |
64
|
|
|
$this->app->singleton('laravel-uptime', function () { |
65
|
|
|
return new LaravelUptime; |
66
|
|
|
}); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Publish Laravel Uptime migration. |
71
|
|
|
*/ |
72
|
|
|
protected function publishMigration() |
73
|
|
|
{ |
74
|
|
|
if (! class_exists('UptimeSetupTables')) { |
75
|
|
|
$timestamp = date('Y_m_d_His', time()); |
76
|
|
|
$this->publishes([ |
77
|
|
|
__DIR__.'/../database/migrations/2016_05_18_000000_uptime_setup_tables.php' => database_path('migrations/'.$timestamp.'_uptime_setup_tables.php'), |
78
|
|
|
], 'migrations'); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|