src/Spiritix/LadaCache/Console/Command.php
protected function writeConfig($key, $value)
    {
        $file = config_path(LadaCacheServiceProvider::CONFIG_FILE);

        if (!File::exists($file)) {
            $this->call('vendor:publish');
        }

        try {
            $contents = File::get($file);

            $contents = preg_replace(
                "/'" . $key . "'(.*?),\s?\n/s",
                "'" . $key . "' => " . $value . ",\n\n",
                $contents
            );

            File::put($file, $contents);
        }
        catch (Exception $e) {
            $this->error('Could not write config file');

            return false;
        }

        $this->call('config:clear');

        return true;
    }
protected function writeConfig($key, $value)
    {
        $file = config_path(LadaCacheServiceProvider::CONFIG_FILE);

        if (!File::exists($file)) {
            $this->call('vendor:publish');
        }

        try {
            $contents = File::get($file);

            $contents = preg_replace(
                "/'" . $key . "'(.*?),\s?\n/s",
                "'" . $key . "' => " . $value . ",\n\n",
                $contents
            );

            File::put($file, $contents);
        }
        catch (Exception $e) {
            $this->error('Could not write config file');

            return false;
        }

        $this->call('config:clear');

        return true;
    }
protected function writeConfig ( $ key , $ value ) { $ file = config_path ( LadaCacheServiceProvider :: CONFIG_FILE ) ; if ( ! File :: exists ( $ file ) ) { $ this -> call ( 'vendor:publish' ) ; } try { $ contents = File :: get ( $ file ) ; $ contents = preg_replace ( "/'" . $ key . "'(.*?),\s?\n/s" , "'" . $ key . "' => " . $ value . ",\n\n" , $ contents ) ; File :: put ( $ file , $ contents ) ; } catch ( Exception $ e ) { $ this -> error ( 'Could not write config file' ) ; return false ; } $ this -> call ( 'config:clear' ) ; return true ; }
Writes a value to package configuration file.
Writes a value to package configuration file .