Skip to content

Commit 453cf7b

Browse files
committed
remove LaravelDb::class from bootstrap
1 parent d343900 commit 453cf7b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/Initializer.php

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
class Initializer
3131
{
3232

33+
/**
34+
* @var bool
35+
*/
3336
private static bool $initialized = false;
3437

3538
/**

src/Install.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ public static function install(): void
2222
copy(__DIR__ . '/config/database.php', $database_file);
2323
}
2424
static::installByRelation();
25+
static::removeLaravelDbFromBootstrap();
26+
}
27+
28+
/**
29+
* @return void
30+
*/
31+
protected static function removeLaravelDbFromBootstrap(): void
32+
{
33+
$file = base_path('config/bootstrap.php');
34+
if (!is_file($file)) {
35+
return;
36+
}
37+
$pattern = '/^\s*support\\\\bootstrap\\\\LaravelDb::class,\s*?\r?\n/m';
38+
$content = file_get_contents($file);
39+
if (preg_match($pattern, $content)) {
40+
$updatedContent = preg_replace($pattern, '', $content);
41+
file_put_contents($file, $updatedContent);
42+
}
2543
}
2644

2745
/**
@@ -69,5 +87,5 @@ public static function uninstallByRelation(): void
6987
remove_dir($path);
7088
}
7189
}
72-
90+
7391
}

0 commit comments

Comments
 (0)