Evercode1\ViewMaker\RemoveChart::removeChartScriptFromIndex PHP Method

removeChartScriptFromIndex() private method

    private function removeChartScriptFromIndex()
    {
        $start = '<!-- Begin Chart Script -->';
        $end = '<!-- End Chart Script -->';
        $replaceWith = '<!-- Chart Script Placeholder -->';
        $file = base_path('resources/views/' . $this->modelPath . '/index.blade.php');
        //read the entire string from file
        $content = file_get_contents($file);
        // define pattern
        $stringToDelete = $this->patternMatch($start, $end, $content);
        //replace the file string
        $updatedContent = str_replace("{$stringToDelete}", "{$replaceWith}", $content);
        //writes the entire file with updated content
        file_put_contents($file, $updatedContent);
    }