Merge pull request #2551 from ghermans/webinstall
#2525 - Console command update
This commit is contained in:
commit
22f6483b9e
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -78,35 +78,57 @@ class install extends Command
|
||||||
{
|
{
|
||||||
$envExists = File::exists(base_path() . '/.env');
|
$envExists = File::exists(base_path() . '/.env');
|
||||||
if (!$envExists) {
|
if (!$envExists) {
|
||||||
$this->info('Creating .env file');
|
$this->info('Creating the environment configuration file.');
|
||||||
$this->createEnvFile();
|
$this->createEnvFile();
|
||||||
} else {
|
} else {
|
||||||
$this->info('Great! .env file aready exists');
|
$this->info('Great! your environment configuration file aready exists.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new .env file.
|
||||||
|
*/
|
||||||
public function createEnvFile()
|
public function createEnvFile()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
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('Please enter the default timezone', $TimeZones, date_default_timezone_get());
|
||||||
|
$this->envUpdate('APP_TIMEZONE=', $timezone);
|
||||||
|
|
||||||
|
$currency = $this->choice('Please 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.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the database credentials to the .env file.
|
||||||
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the .env values.
|
||||||
|
*/
|
||||||
public static function envUpdate($key, $value)
|
public static function envUpdate($key, $value)
|
||||||
{
|
{
|
||||||
$path = base_path() . '/.env';
|
$path = base_path() . '/.env';
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'locale' => 'en',
|
'locale' => env('APP_LOCALE', 'en'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
@ -116,8 +116,8 @@ return [
|
||||||
| Here you may specify the base currency code for your application.
|
| Here you may specify the base currency code for your application.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'currency' => env('APP_CURRENCY','USD'),
|
'currency' => env('APP_CURRENCY', 'USD'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue