1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Schubu\Cronify; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
6
|
|
|
use Schubu\Cronify\Console\Commands\CronifyCommands; |
7
|
|
|
|
8
|
|
|
class CronifyServiceProvider extends ServiceProvider |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Bootstrap the application services. |
12
|
|
|
*/ |
13
|
|
|
public function boot() |
14
|
|
|
{ |
15
|
|
|
/* |
16
|
|
|
* Optional methods to load your package assets |
17
|
|
|
*/ |
18
|
|
|
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'cronify'); |
19
|
|
|
// $this->loadViewsFrom(__DIR__.'/../resources/views', 'cronify'); |
20
|
|
|
// $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
21
|
|
|
// $this->loadRoutesFrom(__DIR__.'/routes.php'); |
22
|
|
|
|
23
|
|
|
if ($this->app->runningInConsole()) { |
24
|
|
|
/* $this->publishes([ |
25
|
|
|
__DIR__.'/../config/config.php' => config_path('cronify.php'), |
26
|
|
|
], 'config');*/ |
27
|
|
|
|
28
|
|
|
if (! class_exists('CreateCronsTable')) { |
29
|
|
|
$this->publishes([ |
30
|
|
|
__DIR__ . '/../database/migrations/create_crons_table.php.stub' => database_path('migrations/' . date('Y_m_d_His', time()) . '_create_crons_table.php'), |
31
|
|
|
// you can add any number of migrations here |
32
|
|
|
], 'migrations'); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
$this->commands([ |
36
|
|
|
CronifyCommands::class, |
37
|
|
|
]); |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
// Publishing the views. |
41
|
|
|
/*$this->publishes([ |
42
|
|
|
__DIR__.'/../resources/views' => resource_path('views/vendor/cronify'), |
43
|
|
|
], 'views');*/ |
44
|
|
|
|
45
|
|
|
// Publishing assets. |
46
|
|
|
/*$this->publishes([ |
47
|
|
|
__DIR__.'/../resources/assets' => public_path('vendor/cronify'), |
48
|
|
|
], 'assets');*/ |
49
|
|
|
|
50
|
|
|
// Publishing the translation files. |
51
|
|
|
/*$this->publishes([ |
52
|
|
|
__DIR__.'/../resources/lang' => resource_path('lang/vendor/cronify'), |
53
|
|
|
], 'lang');*/ |
54
|
|
|
|
55
|
|
|
// Registering package commands. |
56
|
|
|
// $this->commands([]); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Register the application services. |
62
|
|
|
*/ |
63
|
|
|
public function register() |
64
|
|
|
{ |
65
|
|
|
// Automatically apply the package configuration |
66
|
|
|
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'cronify'); |
67
|
|
|
|
68
|
|
|
// Register the main class to use with the facade |
69
|
|
|
$this->app->singleton('cronify', function () { |
70
|
|
|
return new Cronify; |
71
|
|
|
}); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|