2018-03-10 15:18:24 -06:00
|
|
|
<?php
|
|
|
|
|
|
2024-03-12 22:39:16 -04:00
|
|
|
namespace App\Console\Commands\Overrides;
|
2018-03-10 15:18:24 -06:00
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Console\KeyGenerateCommand as BaseKeyGenerateCommand;
|
|
|
|
|
|
|
|
|
|
class KeyGenerateCommand extends BaseKeyGenerateCommand
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Override the default Laravel key generation command to throw a warning to the user
|
|
|
|
|
* if it appears that they have already generated an application encryption key.
|
|
|
|
|
*/
|
2024-03-19 21:12:27 -04:00
|
|
|
public function handle(): void
|
2018-03-10 15:18:24 -06:00
|
|
|
{
|
2021-01-23 12:33:34 -08:00
|
|
|
if (!empty(config('app.key')) && $this->input->isInteractive()) {
|
2025-02-11 22:16:48 +01:00
|
|
|
$this->output->warning(trans('commands.key_generate.error_already_exist'));
|
|
|
|
|
if (!$this->confirm(trans('commands.key_generate.understand'))) {
|
2018-03-10 15:18:24 -06:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-11 22:16:48 +01:00
|
|
|
if (!$this->confirm(trans('commands.key_generate.continue'))) {
|
2018-03-10 15:18:24 -06:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parent::handle();
|
|
|
|
|
}
|
|
|
|
|
}
|