public function downloadAll() { foreach (Chapter::all() as $chapter) { if ($chapter->state != 'detected') { continue; } $dom = Utils::getDom($chapter->url); $content = $dom->find('.content', 0)->text(); $content = str_replace(str_repeat(' ', 4), "\n\t", $content); $chapter->content = $content; $chapter->state = 'downloaded'; $chapter->save(); } }