Browse Source

Update AppServiceProvider.php

search-enhancements
KodeStar 6 years ago
committed by GitHub
parent
commit
cbef469e02
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      app/Providers/AppServiceProvider.php

17
app/Providers/AppServiceProvider.php

@ -22,8 +22,8 @@ class AppServiceProvider extends ServiceProvider
if(!is_file(base_path('.env'))) { if(!is_file(base_path('.env'))) {
copy(base_path('.env.example'), base_path('.env')); copy(base_path('.env.example'), base_path('.env'));
Artisan::call('key:generate');
} }
$this->genKey();
if(!is_file(database_path('app.sqlite'))) { if(!is_file(database_path('app.sqlite'))) {
// first time setup // first time setup
touch(database_path('app.sqlite')); touch(database_path('app.sqlite'));
@ -117,6 +117,21 @@ class AppServiceProvider extends ServiceProvider
} }
/**
* Generate app key if missing and .env exists
*
* @return void
*/
public function genKey()
{
if(is_file(base_path('.env'))) {
if(empty(env('APP_KEY'))) {
Artisan::call('key:generate', array('--force' => true, '--no-interaction' => true));
}
}
}
/** /**
* Register any application services. * Register any application services.
* *

Loading…
Cancel
Save