public function content($folder_id, $id) { $file = File::findWithExtension($id); if (!$file) { return abort(404); } $file_path = "/" . $file->path; $extension = $file->extension; $data["file"] = $file; $data["file_path"] = $file_path; $data["extension"] = $extension; if ($file->sourceCode()) { $data["source_code"] = true; $data["content"] = file_get_contents(public_path($file->path)); } return view("files.file_content", $data); }