Skip to content

Commit 2b53b26

Browse files
Update file with user input values
1 parent 9b30de5 commit 2b53b26

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Skeletorfile.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
$skeletor->intro('Welcome to Larament setup! Let\'s get started.');
77

88
$applicationName = $skeletor->text('What is the application name?', 'Laravel', required: true);
9+
910
$applicationDescription = $skeletor->text('What is the application description?', 'A cool Laravel application');
11+
1012
$timezone = $skeletor->search(
1113
'Which timezone would you like to use?',
1214
fn (string $query) => collect(timezone_identifiers_list())
@@ -18,15 +20,15 @@
1820
$skeletor->intro('Let\'s setup the default user that will be created.');
1921

2022
$name = $skeletor->text('What is the demo username?', 'John Doe', required: true);
23+
2124
$email = $skeletor->text('What is the demo email?', '[email protected]', required: true);
25+
2226
$password = $skeletor->password('What is the demo password?', 'password', required: true);
2327

24-
// If the user entered a name, replace the APP_NAME value in the .env file
2528
if ($applicationName) {
2629
$skeletor->pregReplaceInFile('/^APP_NAME=(.*)$/m', 'APP_NAME="'.$applicationName.'"', '.env');
2730
}
2831

29-
// If the user entered a description, replace the description value in the composer.json file
3032
if ($applicationDescription) {
3133
$skeletor->pregReplaceInFile(
3234
'/"description":\s*".*?"/',
@@ -35,22 +37,18 @@
3537
);
3638
}
3739

38-
// If the user entered a name, replace the DEFAULT_USER_NAME value in the .env file
3940
if ($name) {
4041
$skeletor->pregReplaceInFile('/^DEFAULT_USER_NAME=(".*?"|[^"\s]*|)$/m', 'DEFAULT_USER_NAME="'.$name.'"', '.env');
4142
}
4243

43-
// If the user entered an email, replace the DEFAULT_USER_EMAIL value in the .env file
4444
if ($email) {
4545
$skeletor->pregReplaceInFile('/^DEFAULT_USER_EMAIL=(".*?"|[^"\s]*|)$/m', 'DEFAULT_USER_EMAIL="'.$email.'"', '.env');
4646
}
4747

48-
// If the user entered a password, replace the DEFAULT_USER_PASSWORD value in the .env file
4948
if ($password) {
5049
$skeletor->pregReplaceInFile('/^DEFAULT_USER_PASSWORD=(".*?"|[^"\s]*|)$/m', 'DEFAULT_USER_PASSWORD="'.$password.'"', '.env');
5150
}
5251

53-
// If the user entered a timezone, replace the APP_TIMEZONE value in the .env file
5452
if ($timezone) {
5553
$skeletor->pregReplaceInFile('/^APP_TIMEZONE=(".*?"|[^"\s]*|)$/m', 'APP_TIMEZONE="'.$timezone.'"', '.env');
5654
}

0 commit comments

Comments
 (0)