Browse Source

add artisan command to generate app key

pull/14/merge
Aaron Parecki 7 years ago
parent
commit
6950fdc016
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 17 additions and 0 deletions
  1. +16
    -0
      compass/app/Console/Commands/GenerateKey.php
  2. +1
    -0
      compass/app/Console/Kernel.php

+ 16
- 0
compass/app/Console/Commands/GenerateKey.php View File

@ -0,0 +1,16 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class GenerateKey extends Command {
protected $signature = 'key:generate';
protected $description = 'Generate a random key for APP_KEY';
public function handle() {
$key = bin2hex(random_bytes(16));
$this->line('Below is a random string you can use for APP_KEY in the .env file');
$this->info($key);
}
}

+ 1
- 0
compass/app/Console/Kernel.php View File

@ -15,6 +15,7 @@ class Kernel extends ConsoleKernel
protected $commands = [ protected $commands = [
'App\Console\Commands\TestTrip', 'App\Console\Commands\TestTrip',
'App\Console\Commands\CleanFile', 'App\Console\Commands\CleanFile',
'App\Console\Commands\GenerateKey'
]; ];
/** /**

Loading…
Cancel
Save