KodeStar
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
16 additions and
1 deletions
-
app/Providers/AppServiceProvider.php
|
|
@ -22,8 +22,8 @@ class AppServiceProvider extends ServiceProvider |
|
|
|
|
|
|
|
if(!is_file(base_path('.env'))) { |
|
|
|
copy(base_path('.env.example'), base_path('.env')); |
|
|
|
Artisan::call('key:generate'); |
|
|
|
} |
|
|
|
$this->genKey(); |
|
|
|
if(!is_file(database_path('app.sqlite'))) { |
|
|
|
// first time setup |
|
|
|
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. |
|
|
|
* |
|
|
|