get(); dump(count($TransProducts)); $c = 0; foreach($TransProducts as $item){ if($item->value){ $item->value = self::cleanHTML($item->value); $item->save(); //dump($item->value); $c++; } } dump("counter TransProduct"); dump($c); $Products = Product::limit(2000)->get(); dump(count($Products)); $c = 0; foreach($Products as $item){ if($item){ $item->copy = self::cleanHTML($item->copy); $item->description = self::cleanHTML($item->description); $item->usage = self::cleanHTML($item->usage); $item->ingredients = self::cleanHTML($item->ingredients); $item->save(); //dump($item->value); $c++; } } dump("counter"); dd($c); } public static function cleanHTML($html) { // $html = preg_replace("/(

', '', $html); $html = str_replace('

', '', $html); $html = str_replace('


', '', $html); $html = str_replace('


', '', $html); $html = str_replace('
', '', $html); $html = str_replace('text -primary', 'text-primary', $html); $html = str_replace('fa -check', 'fa-check', $html); $html = str_replace('text- primary', 'text-primary', $html); $html = str_replace('fa- check', 'fa-check', $html); $html = str_replace('', '', $html); $html = str_replace('', '', $html); $html = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $html); $html = str_replace('
  • ', '', $html); $html = str_replace('
  • ', '', $html); $html = str_replace('< i', '', '
  • ', $html); $html = str_replace('', '', $html); $html = str_replace('', '
  • ', $html); $html = str_replace('', '', $html); $html = str_replace('< /b>', '', $html); $html = str_replace('', '

    ', $html); $html = str_replace('< /p>', '

    ', $html); $html = str_replace('< /i>', '', $html); $html = str_replace('< /li>', '', $html); $html = str_replace('
    ', '', $html); $html = str_replace('
    ', '', $html); $html = str_replace('>>', '>', $html); return $html; } public static function store() { $data = Request::all(); \Session()->flash('alert-save', true); return back(); } }