#2525 Added locale, timezone and currency

This commit is contained in:
ghermans 2020-02-25 03:29:33 +01:00
parent 5df38b73a4
commit bb9c90d0a2
3 changed files with 19 additions and 5 deletions

View File

@ -4,9 +4,10 @@ APP_VERSION=1.0.0
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost APP_URL=http://localhost
APP_TIMEZONE='Asia/Kolkata' APP_TIMEZONE=
APP_LOCALE=
LOG_CHANNEL=stack LOG_CHANNEL=stack
APP_CURRENCY=USD APP_CURRENCY=
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=127.0.0.1 DB_HOST=127.0.0.1

View File

@ -91,17 +91,30 @@ class install extends Command
File::copy('.env.example', '.env'); File::copy('.env.example', '.env');
Artisan::call('key:generate'); Artisan::call('key:generate');
$this->envUpdate('APP_URL=http://localhost', ':8000'); $this->envUpdate('APP_URL=http://localhost', ':8000');
$locale = $this->choice('Please select the default locale or press enter to continue', ['ar', 'en', 'fa', 'nl', 'pt_BR'], 1);
$this->envUpdate('APP_LOCALE=', $locale);
$TimeZones = timezone_identifiers_list();
$timezone = $this->anticipate('Enter the default timezone', $TimeZones, date_default_timezone_get());
$this->envUpdate('APP_TIMEZONE=', $timezone);
$currency = $this->choice('Enter the default currency', ['USD', 'EUR'], 'USD');
$this->envUpdate('APP_CURRENCY=', $currency);
$this->addDatabaseDetails(); $this->addDatabaseDetails();
} catch (\Exception $e) { } catch (\Exception $e) {
$this->error('Error in creating .env file, please create manually and then run `php artisan migrate` again'); $this->error('Error in creating .env file, please create it manually and then run `php artisan migrate` again');
} }
} }
public function addDatabaseDetails() public function addDatabaseDetails()
{ {
$dbName = $this->ask('What is your database name to be used by bagisto'); $dbName = $this->ask('What is the database name to be used by bagisto');
$dbUser = $this->anticipate('What is your database username', ['root']); $dbUser = $this->anticipate('What is your database username', ['root']);
$dbPass = $this->secret('What is your database password'); $dbPass = $this->secret('What is your database password');
$this->envUpdate('DB_DATABASE=', $dbName); $this->envUpdate('DB_DATABASE=', $dbName);
$this->envUpdate('DB_USERNAME=', $dbUser); $this->envUpdate('DB_USERNAME=', $dbUser);
$this->envUpdate('DB_PASSWORD=', $dbPass); $this->envUpdate('DB_PASSWORD=', $dbPass);

View File

@ -78,7 +78,7 @@ return [
| |
*/ */
'locale' => 'en', 'locale' => env('APP_LOCALE', 'en'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------