Sebpro\ArtisanExt\Commands\ExtRedisPort::handle PHP Method

handle() public method

Execute the console command.
public handle ( ) : void
return void
    public function handle()
    {
        $old_redis_port = $this->laravel['config']['database.redis.' . 'default.port'];
        $file = base_path('.env');
        if (file_exists($file)) {
            file_put_contents($file, str_replace('REDIS_PORT=' . $old_redis_port, 'REDIS_PORT=' . $this->argument('redisport'), file_get_contents($file)));
            return $this->info('The redis port has been changed ' . 'successfully to: ' . $this->argument('redisport'));
        }
        return $this->error('The .env configuration file is missing.');
    }