Skip to content

Commit d8d8548

Browse files
Prompt user for app name, email, password & timezone, update
1 parent c965b0b commit d8d8548

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Skeletorfile.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,40 @@
33
use NiftyCo\Skeletor\Skeletor;
44

55
return function (Skeletor $skeletor) {
6-
// Update the application name
6+
// Prompt the user for the application name
77
$name = $skeletor->text('Enter the application name:', 'Laravel');
88

9+
// If the user entered a name, replace the APP_NAME value in the .env file
910
if ($name) {
1011
$skeletor->pregReplaceInFile('/^APP_NAME=(.*)$/m', 'APP_NAME='.$name, '.env');
1112
}
1213

13-
// Update the demo user email
14+
// Prompt the user for the demo user email
1415
$email = $skeletor->text('Enter the demo email:', '[email protected]');
1516

17+
// If the user entered an email, replace the DEFAULT_USER_EMAIL value in the .env file
1618
if ($email) {
1719
$skeletor->pregReplaceInFile('/^DEFAULT_USER_EMAIL=(".*?"|[^"\s]*|)$/m', 'DEFAULT_USER_EMAIL='.$email, '.env');
1820
}
1921

20-
// Update the demo user password
22+
// Prompt the user for the demo user password
2123
$password = $skeletor->password('Enter the demo password:', 'password');
2224

25+
// If the user entered a password, replace the DEFAULT_USER_PASSWORD value in the .env file
2326
if ($password) {
2427
$skeletor->pregReplaceInFile('/^DEFAULT_USER_PASSWORD=(".*?"|[^"\s]*|)$/m', 'DEFAULT_USER_PASSWORD='.$password, '.env');
2528
}
29+
30+
// Prompt the user for the application locale
31+
$timezone = $skeletor->search('Which timezone do you want to use? ', function ($query) {
32+
return collect(timezone_identifiers_list())
33+
->filter(fn ($timezone) => str_contains(strtolower($timezone), strtolower($query)))
34+
->values()
35+
->all();
36+
});
37+
38+
// If the user entered a timezone, replace the APP_TIMEZONE value in the .env file
39+
if ($timezone) {
40+
$skeletor->pregReplaceInFile('/^APP_TIMEZONE=(".*?"|[^"\s]*|)$/m', 'APP_TIMEZONE='.$timezone, '.env');
41+
}
2642
};

0 commit comments

Comments
 (0)