public function generate() { $files = $this->documentation->getAllFiles(); $view = $this->viewFactory->make('documentation::route_templates.routes', compact('files')); $filePath = storage_path() . "/routes/documentation_routes.php"; $fileContents = "<?php\n\n" . $view->render(); $this->finder->put($filePath, $fileContents); }