diff --git a/Makefile b/Makefile index 6e1ac5d9..8083fafe 100644 --- a/Makefile +++ b/Makefile @@ -90,10 +90,8 @@ deploy-package: .PHONY: reset-installer reset-installer: - @cp .env.dev.example .env - @make clean - mysql -uroot -e "DROP DATABASE IF EXISTS phpvms" - mysql -uroot -e "CREATE DATABASE phpvms" + @php artisan database:create --reset + @php artisan migrate:refresh --seed .PHONY: docker docker: diff --git a/Procfile b/Procfile index dd368790..1729d537 100644 --- a/Procfile +++ b/Procfile @@ -1,5 +1,5 @@ dnsmasq: /usr/local/sbin/dnsmasq --keep-in-foreground php-fpm: /usr/local/sbin/php-fpm --nodaemonize nginx: /usr/local/bin/nginx -#mysql: /usr/local/bin/mysqld +mysql: /usr/local/bin/mysqld mailhog: /usr/local/bin/mailhog diff --git a/app/Console/Commands/DevCommands.php b/app/Console/Commands/DevCommands.php index 308f7348..3146934f 100644 --- a/app/Console/Commands/DevCommands.php +++ b/app/Console/Commands/DevCommands.php @@ -2,6 +2,10 @@ namespace App\Console\Commands; +use App\Models\Airline; +use App\Models\Permission; +use App\Models\Role; +use App\Models\User; use App\Services\DatabaseService; use DB; @@ -28,8 +32,8 @@ class DevCommands extends BaseCommand $commands = [ 'clear-acars' => 'clearAcars', + 'clear-users' => 'clearUsers', 'compile-assets' => 'compileAssets', - 'test-api' => 'testApi', ]; if(!array_key_exists($command, $commands)) { @@ -59,6 +63,26 @@ class DevCommands extends BaseCommand $this->info('ACARS and PIREPs cleared!'); } + /** + * Delete all the data from the ACARS and PIREP tables + */ + protected function clearUsers() + { + if (config('database.default') === 'mysql') { + DB::statement('SET foreign_key_checks=0'); + } + + DB::statement('TRUNCATE `role_user`'); + Airline::truncate(); + User::truncate(); + + if (config('database.default') === 'mysql') { + DB::statement('SET foreign_key_checks=1'); + } + + $this->info('Users cleared!'); + } + /** * Compile all the CSS/JS assets into their respective files * Calling the webpack compiler diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index 4390f858..e0e203bb 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -217,6 +217,7 @@ class InstallerController extends AppBaseController $validator = Validator::make($request->all(), [ 'airline_name' => 'required', 'airline_icao' => 'required|unique:airlines,icao', + 'name' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required|confirmed' ]); @@ -259,9 +260,7 @@ class InstallerController extends AppBaseController Log::info('User registered: ', $user->toArray()); # Set the intial admin e-mail address - $admin_email = Setting::where('key', 'general.admin_email'); - $admin_email->value = $user->email; - $admin_email->save(); + setting('general.admin_email', $user->email); return view('installer::steps/step3a-completed', []); } diff --git a/modules/Installer/Resources/views/steps/step3-user.blade.php b/modules/Installer/Resources/views/steps/step3-user.blade.php index 15607860..ac58d31c 100644 --- a/modules/Installer/Resources/views/steps/step3-user.blade.php +++ b/modules/Installer/Resources/views/steps/step3-user.blade.php @@ -36,7 +36,17 @@
Admin Email
Name