File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -163,21 +163,22 @@ protected function generateMimeType(): void
163163 * @param string $path
164164 * @return void
165165 */
166- public function saveRaw (string $ path ): void
166+ public function saveRaw (string $ path ): string
167167 {
168168 $ this ->generateEpub ();
169- FileManager::getInstance ()->copyAllTo ($ path );
169+ return FileManager::getInstance ()->copyAllTo ($ path );
170170 }
171171
172- public function save (string $ path , string $ filename = null ): void
172+ public function save (string $ path , string $ filename = null ): string
173173 {
174174 $ this ->generateEpub ();
175- $ filename = $ filename ?: Str::slugify ($ this ->getTitle ()) . '.epub ' ;
176- FileManager::getInstance ()->compressAllTo ($ filename , $ path );
175+ return FileManager::getInstance ()->compressAllTo ($ this ->getFilename ($ filename ), $ path );
177176 }
178177
179- public function download ()
178+ public function download (string $ filename = null )
180179 {
180+ $ this ->generateEpub ();
181+ return FileManager::getInstance ()->download ($ this ->getFilename ($ filename ));
181182 }
182183
183184 /**
@@ -195,4 +196,9 @@ public function setTitle(string $title): void
195196 {
196197 $ this ->title = $ title ;
197198 }
199+
200+ protected function getFilename (string $ filename = null ): string
201+ {
202+ return $ filename ?: Str::slugify ($ this ->getTitle ()) . '.epub ' ;
203+ }
198204}
You can’t perform that action at this time.
0 commit comments