wzq il y a 5 ans
Parent
commit
b89a8e284f
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      app/Console/Commands/Downloads.php

+ 3 - 0
app/Console/Commands/Downloads.php

@@ -12,6 +12,7 @@ use App\Repositories\Post\PostRepository;
 use Illuminate\Console\Command;
 use App\Models\Download;
 use Illuminate\Support\Carbon;
+use Illuminate\Support\Facades\Storage;
 
 class Downloads extends Command
 {
@@ -79,9 +80,11 @@ class Downloads extends Command
 
         try {
             $this->postRepository->download($filePath, $download->download_type, json_decode($download->params, true));
+            Storage::put($filePath, file_get_contents(public_path($filePath)));
             $download->url = $filePath;
             $download->download_status = 2;
             $download->save();
+            unlink(public_path($filePath));
         } catch (\Exception $e) {
             $download->download_status = 3;
             $download->url = $e->getMessage();