diff options
author | Khaled Lela <eng.khaled.lela@gmail.com> | 2022-02-11 20:30:36 +0200 |
---|---|---|
committer | Khaled Lela <eng.khaled.lela@gmail.com> | 2022-02-11 20:30:36 +0200 |
commit | 5eba0307dbdd15d1a215419ff9fd3e3f96f99f0e (patch) | |
tree | e7d9cc62a0c9f43a6b538cf40d8d7e779b480d75 /src/ScormServiceProvider.php | |
parent | f2faa8f007834444a129db4fb8f4ece901b21fed (diff) |
handle publish scorm runtime exception msg key as translation under resources/lang/en-US/scorm.php
Diffstat (limited to 'src/ScormServiceProvider.php')
-rw-r--r-- | src/ScormServiceProvider.php | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/ScormServiceProvider.php b/src/ScormServiceProvider.php index 1806775..b50adc4 100644 --- a/src/ScormServiceProvider.php +++ b/src/ScormServiceProvider.php @@ -13,7 +13,7 @@ class ScormServiceProvider extends ServiceProvider { public function register() { - $this->app->bind('scorm-manager', function($app) { + $this->app->bind('scorm-manager', function ($app) { return new ScormManager(); }); } @@ -23,19 +23,24 @@ class ScormServiceProvider extends ServiceProvider $this->offerPublishing(); } - protected function offerPublishing() { + protected function offerPublishing() + { // function not available and 'publish' not relevant in Lumen - if (! function_exists('config_path')) { + if (!function_exists('config_path')) { return; } $this->publishes([ - __DIR__.'/../config/scorm.php' => config_path('scorm.php'), + __DIR__ . '/../config/scorm.php' => config_path('scorm.php'), ], 'config'); $this->publishes([ - __DIR__.'/../database/migrations/create_scorm_tables.php.stub' => $this->getMigrationFileName('create_scorm_tables.php'), + __DIR__ . '/../database/migrations/create_scorm_tables.php.stub' => $this->getMigrationFileName('create_scorm_tables.php'), ], 'migrations'); + + $this->publishes([ + __DIR__ . '/../resources/lang/en-US/scorm.php' => resource_path('lang/en-US/scorm.php'), + ]); } /** @@ -49,14 +54,14 @@ class ScormServiceProvider extends ServiceProvider $filesystem = $this->app->make(Filesystem::class); - return Collection::make($this->app->databasePath().DIRECTORY_SEPARATOR.'migrations'.DIRECTORY_SEPARATOR) + return Collection::make($this->app->databasePath() . DIRECTORY_SEPARATOR . 'migrations' . DIRECTORY_SEPARATOR) ->flatMap(function ($path) use ($filesystem) { - return $filesystem->glob($path.'*_create_scorm_tables.php'); - })->push($this->app->databasePath()."/migrations/{$timestamp}_create_scorm_tables.php") + return $filesystem->glob($path . '*_create_scorm_tables.php'); + })->push($this->app->databasePath() . "/migrations/{$timestamp}_create_scorm_tables.php") ->flatMap(function ($path) use ($filesystem, $migrationFileName) { - return $filesystem->glob($path.'*_'.$migrationFileName); + return $filesystem->glob($path . '*_' . $migrationFileName); }) - ->push($this->app->databasePath()."/migrations/{$timestamp}_{$migrationFileName}") + ->push($this->app->databasePath() . "/migrations/{$timestamp}_{$migrationFileName}") ->first(); } } |