File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ public function handle()
3131 $ this ->ensureTrixFieldComponentIsCopied ();
3232 $ this ->updateAppLayoutFiles ();
3333 $ this ->updateJsDependencies ();
34+ $ this ->runDatabaseMigrations ();
3435
3536 $ this ->newLine ();
3637 $ this ->components ->info ('Rich Text Laravel was installed successfully. ' );
@@ -58,6 +59,32 @@ private function updateJsDependencies()
5859 }
5960 }
6061
62+ private function runDatabaseMigrations ()
63+ {
64+ if (! $ this ->confirm ('A new migration was published to your app. Do you want to run it now? ' , true )) {
65+ return ;
66+ }
67+
68+ if ($ this ->runningSail () && ! env ('LARAVEL_SAIL ' )) {
69+ FacadesProcess::forever ()->run ([
70+ './vendor/bin/sail ' ,
71+ 'artisan ' ,
72+ 'migrate ' ,
73+ ], fn ($ _type , $ output ) => $ this ->output ->write ($ output ));
74+ } else {
75+ FacadesProcess::forever ()->run ([
76+ $ this ->phpBinary (),
77+ 'artisan ' ,
78+ 'migrate ' ,
79+ ], fn ($ _type , $ output ) => $ this ->output ->write ($ output ));
80+ }
81+ }
82+
83+ private function runningSail (): bool
84+ {
85+ return file_exists (base_path ('docker-compose.yml ' )) && str_contains (file_get_contents (base_path ('composer.json ' )), 'laravel/sail ' );
86+ }
87+
6188 private function usingImportmaps (): bool
6289 {
6390 return File::exists (base_path ('routes/importmap.php ' ));
You can’t perform that action at this time.
0 commit comments