Skip to content

Commit a78d471

Browse files
committed
Improved compatibility
Now running seeder and migrations without console commands
1 parent 738d224 commit a78d471

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

resources/views/components/finishing.blade.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22
use Illuminate\Database\Migrations\Migration;
3+
use Illuminate\Database\Migrations\Migrator;
34
use Illuminate\Database\Schema\Blueprint;
45
use Illuminate\Support\Facades\Schema;
56
use Illuminate\Support\Facades\DB;
67
use Illuminate\Support\Facades\File;
8+
use Database\Seeders\ButtonSeeder;
79
use App\Models\Page;
810
911
//run before finishing:
@@ -130,10 +132,16 @@
130132
131133
/* Updates button database entries */
132134
Schema::disableForeignKeyConstraints();
133-
try {Artisan::call('migrate', ['--force' => true]);} catch (exception $e) {}
135+
try {
136+
$migrator = app('migrator');
137+
$migrator->run(database_path('migrations'), ['--force' => true]);
138+
} catch (exception $e) {}
134139
try {DB::table('buttons')->delete();} catch (exception $e) {}
135140
try {DB::table('buttons')->truncate();} catch (exception $e) {}
136-
try {Artisan::call('db:seed --class="ButtonSeeder" --force');} catch (exception $e) {}
141+
try {
142+
$seeder = new ButtonSeeder();
143+
$seeder->run();
144+
} catch (exception $e) {}
137145
Schema::enableForeignKeyConstraints();
138146
139147
try {

0 commit comments

Comments
 (0)