| Total Complexity | 4 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
||
| 6 | { |
||
| 7 | |||
| 8 | protected $defer = false; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Bootstrap the application events. |
||
| 12 | */ |
||
| 13 | public function boot() |
||
| 14 | { |
||
| 15 | /* |
||
| 16 | * Publish configuration file |
||
| 17 | */ |
||
| 18 | $this->publishes([ |
||
| 19 | __DIR__ . '/../config/log-envelope.php' => config_path('yaro.log-envelope.php'), |
||
|
|
|||
| 20 | ]); |
||
| 21 | |||
| 22 | /* |
||
| 23 | * Publish migration if not published yet |
||
| 24 | */ |
||
| 25 | if (!$this->migrationHasAlreadyBeenPublished()) { |
||
| 26 | $timestamp = date('Y_m_d_His', time()); |
||
| 27 | $this->publishes([ |
||
| 28 | __DIR__ . '/../resources/migrations/create_exceptions_table.php.stub' => database_path('migrations/' . $timestamp . '_create_exceptions_table.php'), |
||
| 29 | ], 'migrations'); |
||
| 30 | } |
||
| 31 | |||
| 32 | $this->app['view']->addNamespace('log-envelope', __DIR__ . '/../resources/views'); |
||
| 33 | |||
| 34 | $loader = \Illuminate\Foundation\AliasLoader::getInstance(); |
||
| 35 | $loader->alias('LogEnvelope', 'Yaro\LogEnvelope\Facade'); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Register the service provider. |
||
| 40 | */ |
||
| 41 | public function register() |
||
| 42 | { |
||
| 43 | config([ |
||
| 44 | 'config/yaro.log-envelope.php', |
||
| 45 | ]); |
||
| 46 | |||
| 47 | $this->app->singleton('yaro.log-envelope', function($app) { |
||
| 48 | return new LogEnvelope(); |
||
| 49 | }); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return bool |
||
| 54 | */ |
||
| 55 | protected function migrationHasAlreadyBeenPublished() |
||
| 59 | } |
||
| 60 | |||
| 61 | } |
||
| 62 |