diff --git a/Makefile b/Makefile index 4476128b..d097b99c 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ install: build update: build @php composer.phar dump-autoload @php composer.phar update --no-interaction - @php artisan migrate + @php artisan migrate --force @echo "Done!" .PHONY: reset diff --git a/app/Database/seeds/DatabaseSeeder.php b/app/Database/seeds/DatabaseSeeder.php index 9d379886..f9d5c71b 100755 --- a/app/Database/seeds/DatabaseSeeder.php +++ b/app/Database/seeds/DatabaseSeeder.php @@ -25,7 +25,6 @@ class DatabaseSeeder extends Seeder } $path = database_path('seeds/'.$env.'.yml'); - print("Seeding seeds/$env.yml\n"); if(!file_exists($path)) { $path = database_path('seeds/prod.yml'); diff --git a/app/Services/DatabaseService.php b/app/Services/DatabaseService.php index f47c345b..7e6018b2 100644 --- a/app/Services/DatabaseService.php +++ b/app/Services/DatabaseService.php @@ -2,7 +2,9 @@ namespace App\Services; +use Log; use Carbon\Carbon; +use Illuminate\Database\QueryException; use Webpatser\Uuid\Uuid; use Symfony\Component\Yaml\Yaml; use Illuminate\Support\Facades\DB; @@ -58,7 +60,11 @@ class DatabaseService extends BaseService } } - DB::table($table)->insert($row); + try { + DB::table($table)->insert($row); + } catch(QueryException $e) { + Log::info($e->getMessage()); + } } } } diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index c8a9abd0..6fedb849 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -117,9 +117,13 @@ class InstallerController extends AppBaseController ); $log[] = 'Creating database'; - $this->dbService->setupDB(); + $console_out = $this->dbService->setupDB(); - return redirect('/'); + return view('installer::steps/step2a-completed', [ + 'console_output' => $console_out + ]); + + //return redirect('/'); } /** @@ -129,4 +133,9 @@ class InstallerController extends AppBaseController { } + + public function complete(Request $request) + { + return redirect('/'); + } } diff --git a/modules/Installer/Http/Routes/install.php b/modules/Installer/Http/Routes/install.php index 4ce0fd77..012d0fc6 100644 --- a/modules/Installer/Http/Routes/install.php +++ b/modules/Installer/Http/Routes/install.php @@ -8,3 +8,5 @@ Route::get('/step3', 'InstallerController@step3')->name('step3'); Route::post('/dbtest', 'InstallerController@dbtest')->name('dbtest'); Route::post('/dbsetup', 'InstallerController@dbsetup')->name('dbsetup'); + +Route::get('/complete', 'InstallerController@complete')->name('complete'); diff --git a/modules/Installer/Resources/views/app.blade.php b/modules/Installer/Resources/views/app.blade.php index 9efbb93d..c04307ef 100644 --- a/modules/Installer/Resources/views/app.blade.php +++ b/modules/Installer/Resources/views/app.blade.php @@ -18,6 +18,7 @@ + @yield('css') @@ -59,6 +60,8 @@
+ + diff --git a/modules/Installer/Resources/views/steps/step2a-completed.blade.php b/modules/Installer/Resources/views/steps/step2a-completed.blade.php new file mode 100644 index 00000000..5af7b17d --- /dev/null +++ b/modules/Installer/Resources/views/steps/step2a-completed.blade.php @@ -0,0 +1,18 @@ +@extends('installer::app') +@section('title', 'Database Setup') +@section('content') +
+ {!! Form::open(['route' => 'installer.complete', 'method' => 'GET']) !!} + +
+        
+        {!! $console_output !!}
+        
+    
+ +

+ {!! Form::submit('Complete Setup >>', ['class' => 'btn btn-success']) !!} +

+ {!! Form::close() !!} +
+@endsection diff --git a/modules/Installer/Services/DatabaseService.php b/modules/Installer/Services/DatabaseService.php index 56d93e64..b3f7b177 100644 --- a/modules/Installer/Services/DatabaseService.php +++ b/modules/Installer/Services/DatabaseService.php @@ -44,7 +44,16 @@ class DatabaseService { */ public function setupDB() { - \Artisan::call('database:create'); - \Artisan::call('migrate:refresh'); + $output = ""; + #\Artisan::call('database:create'); + #$output .= \Artisan::output(); + + \Artisan::call('migrate'); + $output .= \Artisan::output(); + + \Artisan::call('db:seed'); + $output .= \Artisan::output(); + + return $output; } } diff --git a/public/assets/frontend/css/installer.css b/public/assets/frontend/css/installer.css new file mode 100644 index 00000000..2b088f36 --- /dev/null +++ b/public/assets/frontend/css/installer.css @@ -0,0 +1,135 @@ +/* desert scheme ported from vim to google prettify */ +pre.prettyprint { + display: block; + padding-left: 4px; + background-color: #333 +} + +pre .nocode { + background-color: none; + color: #000 +} + +pre .str { + color: #ffa0a0 +} + +/* string - pink */ +pre .kwd { + color: #f0e68c; + font-weight: bold +} + +pre .com { + color: #87ceeb +} + +/* comment - skyblue */ +pre .typ { + color: #98fb98 +} + +/* type - lightgreen */ +pre .lit { + color: #cd5c5c +} + +/* literal - darkred */ +pre .pun { + color: #fff +} + +/* punctuation */ +pre .pln { + color: #fff +} + +/* plaintext */ +pre .tag { + color: #f0e68c; + font-weight: bold +} + +/* html/xml tag - lightyellow */ +pre .atn { + color: #bdb76b; + font-weight: bold +} + +/* attribute name - khaki */ +pre .atv { + color: #ffa0a0 +} + +/* attribute value - pink */ +pre .dec { + color: #98fb98 +} + +/* decimal - lightgreen */ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; + color: #AEAEAE +} + +/* IE indents via margin-left */ +li.L0, li.L1, li.L2, li.L3, li.L5, li.L6, li.L7, li.L8 { + list-style-type: none +} + +/* Alternate shading for lines */ +li.L1, li.L3, li.L5, li.L7, li.L9 { +} + +@media print { + pre.prettyprint { + background-color: none + } + + pre .str, code .str { + color: #060 + } + + pre .kwd, code .kwd { + color: #006; + font-weight: bold + } + + pre .com, code .com { + color: #600; + font-style: italic + } + + pre .typ, code .typ { + color: #404; + font-weight: bold + } + + pre .lit, code .lit { + color: #044 + } + + pre .pun, code .pun { + color: #440 + } + + pre .pln, code .pln { + color: #000 + } + + pre .tag, code .tag { + color: #006; + font-weight: bold + } + + pre .atn, code .atn { + color: #404 + } + + pre .atv, code .atv { + color: #060 + } +}