Skip to content

Commit 2924081

Browse files
committed
feat: update db in env
1 parent 28347d4 commit 2924081

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/CreateCommand.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,8 @@ protected function handle(): int
153153

154154
\Leaf\FS\Directory::delete("$directory/app/views");
155155
\Leaf\FS\Directory::delete("$directory/app/routes");
156-
\Leaf\FS\Directory::delete("$directory/public/index.php");
157156

158157
\Leaf\FS\Directory::copy(__DIR__ . '/themes/api/routes', "$directory/app/routes");
159-
\Leaf\FS\Directory::copy(__DIR__ . '/themes/api/index.php', "$directory/public/index.php");
160158

161159
\Leaf\FS\File::write("$directory/leaf", function ($content) {
162160
return str_replace(
@@ -225,6 +223,16 @@ protected function handle(): int
225223
]);
226224
}
227225

226+
if ($this->projectType !== 'basic') {
227+
\Leaf\FS\File::write("$directory/.env", function ($content) use ($directory) {
228+
return str_replace(
229+
['LEAF_DB_NAME', 'LEAF_DB_USERNAME'],
230+
[basename($directory), 'root'],
231+
$content
232+
);
233+
});
234+
}
235+
228236
if (sprout()->process(implode(' && ', $extraCommands))->setTimeout(null)->run() === 0 || count($extraCommands) === 1) {
229237
$this->writeln("\n🚀 Application scaffolded successfully");
230238
$this->writeln('👉 Get started with the following commands:');

0 commit comments

Comments
 (0)