app/Console/ComposerScripts.php
/**
     * @param Event $event
     *
     * Generate app key if not exists
     */
@param Event $event
Generate app key if not exists
@param Event $event Generate app key if not exists
public static function postInstall(Event $event)
    {
        parent::postInstall($event);
        $laravel = new Application(getcwd());
        $envFile = $laravel->environmentPath();
        (new Dotenv($envFile))->load();
        if (empty(env('APP_KEY'))) {
            require $laravel->bootstrapPath() . '/app.php';
            $artisan = app(\Illuminate\Contracts\Console\Kernel::class);
            $artisan->call('key:generate');
        }
    }
public static function postInstall ( Event $ event ) { parent :: postInstall ( $ event ) ; $ laravel = new Application ( getcwd ( ) ) ; $ envFile = $ laravel -> environmentPath ( ) ; ( new Dotenv ( $ envFile ) ) -> load ( ) ; if ( empty ( env ( 'APP_KEY' ) ) ) { require $ laravel -> bootstrapPath ( ) . '/app.php' ; $ artisan = app ( \ Illuminate \ Contracts \ Console \ Kernel :: class ) ; $ artisan -> call ( 'key:generate' ) ; } }
@param Event $event
 Generate app key if not exists
@param Event $event Generate app key if not exists
/** @var Kernel $artisan */