|
3 | 3 | use NiftyCo\Skeletor\Skeletor; |
4 | 4 |
|
5 | 5 | return function (Skeletor $skeletor) { |
6 | | - // Update the application name |
| 6 | + // Prompt the user for the application name |
7 | 7 | $name = $skeletor->text('Enter the application name:', 'Laravel'); |
8 | 8 |
|
| 9 | + // If the user entered a name, replace the APP_NAME value in the .env file |
9 | 10 | if ($name) { |
10 | 11 | $skeletor->pregReplaceInFile('/^APP_NAME=(.*)$/m', 'APP_NAME='.$name, '.env'); |
11 | 12 | } |
12 | 13 |
|
13 | | - // Update the demo user email |
| 14 | + // Prompt the user for the demo user email |
14 | 15 | $email = $skeletor-> text( 'Enter the demo email:', '[email protected]'); |
15 | 16 |
|
| 17 | + // If the user entered an email, replace the DEFAULT_USER_EMAIL value in the .env file |
16 | 18 | if ($email) { |
17 | 19 | $skeletor->pregReplaceInFile('/^DEFAULT_USER_EMAIL=(".*?"|[^"\s]*|)$/m', 'DEFAULT_USER_EMAIL='.$email, '.env'); |
18 | 20 | } |
19 | 21 |
|
20 | | - // Update the demo user password |
| 22 | + // Prompt the user for the demo user password |
21 | 23 | $password = $skeletor->password('Enter the demo password:', 'password'); |
22 | 24 |
|
| 25 | + // If the user entered a password, replace the DEFAULT_USER_PASSWORD value in the .env file |
23 | 26 | if ($password) { |
24 | 27 | $skeletor->pregReplaceInFile('/^DEFAULT_USER_PASSWORD=(".*?"|[^"\s]*|)$/m', 'DEFAULT_USER_PASSWORD='.$password, '.env'); |
25 | 28 | } |
| 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 | + } |
26 | 42 | }; |
0 commit comments