diff --git a/app/Database/migrations/2017_06_07_014930_create_settings_table.php b/app/Database/migrations/2017_06_07_014930_create_settings_table.php index 38f710c8..d1dc2332 100644 --- a/app/Database/migrations/2017_06_07_014930_create_settings_table.php +++ b/app/Database/migrations/2017_06_07_014930_create_settings_table.php @@ -1,6 +1,7 @@ migrationSvc = new \Modules\Installer\Services\MigrationService(); + $this->migrationSvc = new MigrationService(); } /** @@ -37,7 +38,7 @@ class CreateSettingsTable extends Migration $table->timestamps(); }); - $this->migrationSvc->updateAllSettings(); + $this->migrationSvc->syncAllSettings(); } /** diff --git a/modules/Installer/Services/MigrationService.php b/app/Services/Installer/MigrationService.php similarity index 95% rename from modules/Installer/Services/MigrationService.php rename to app/Services/Installer/MigrationService.php index a95addae..d537f140 100644 --- a/modules/Installer/Services/MigrationService.php +++ b/app/Services/Installer/MigrationService.php @@ -1,6 +1,6 @@ syncAllSettings(); + } + + public function syncAllSettings(): void { $data = file_get_contents(database_path('/seeds/settings.yml')); $yml = Yaml::parse($data); foreach ($yml as $setting) { - if ($setting['key'] === '') { + if (\trim($setting['key']) === '') { continue; } diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index a696ad76..62462340 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -7,6 +7,7 @@ use App\Interfaces\Controller; use App\Models\User; use App\Repositories\AirlineRepository; use App\Services\AnalyticsService; +use App\Services\Installer\MigrationService; use App\Services\UserService; use App\Support\Countries; use Illuminate\Database\QueryException; @@ -16,7 +17,6 @@ use Illuminate\Support\Facades\Validator; use Log; use Modules\Installer\Services\ConfigService; use Modules\Installer\Services\DatabaseService; -use Modules\Installer\Services\MigrationService; use Modules\Installer\Services\RequirementsService; use Symfony\Component\HttpFoundation\File\Exception\FileException; diff --git a/modules/Installer/Http/Controllers/UpdaterController.php b/modules/Installer/Http/Controllers/UpdaterController.php index b682bea3..d5f80903 100644 --- a/modules/Installer/Http/Controllers/UpdaterController.php +++ b/modules/Installer/Http/Controllers/UpdaterController.php @@ -3,9 +3,10 @@ namespace Modules\Installer\Http\Controllers; use App\Interfaces\Controller; +use App\Services\Installer\MigrationService; use Illuminate\Http\Request; use Log; -use Modules\Installer\Services\MigrationService; + /** * Class UpdaterController @@ -36,6 +37,10 @@ class UpdaterController extends Controller /** * Step 1. Check if there's an update available. Check if there * are any unrun migrations + * + * @param Request $request + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function step1(Request $request) { @@ -49,22 +54,23 @@ class UpdaterController extends Controller /** * Step 2 Run all of the migrations + * * @param Request $request + * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function run_migrations(Request $request) { Log::info('Update: run_migrations', $request->post()); - // Resync all of the settings - $this->migrationSvc->updateAllSettings(); - $migrations = $this->migrationSvc->migrationsAvailable(); if(\count($migrations) === 0) { + $this->migrationSvc->syncAllSeeds(); return view('installer::update/steps/step3-update-complete'); } $output = $this->migrationSvc->runAllMigrations(); + $this->migrationSvc->syncAllSeeds(); return view('installer::update/steps/step2-migrations-done', [ 'console_output' => $output, @@ -73,7 +79,9 @@ class UpdaterController extends Controller /** * Final step + * * @param Request $request + * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function complete(Request $request)