diff --git a/app/Console/Commands/SyncFilesToOtherDisk.php b/app/Console/Commands/SyncFilesToOtherDisk.php new file mode 100644 index 0000000..23e1879 --- /dev/null +++ b/app/Console/Commands/SyncFilesToOtherDisk.php @@ -0,0 +1,38 @@ +each(function(File $file) use ($newDisk) { + if(!$file->file_exists) { + return; + } + + $stored = Storage::disk($newDisk)->put($file->path, $file->content); + + if($stored) { + $file->disk = $newDisk; + $file->save(); + } + }); + } +} diff --git a/app/Models/File.php b/app/Models/File.php new file mode 100644 index 0000000..a1c2940 --- /dev/null +++ b/app/Models/File.php @@ -0,0 +1,25 @@ +disk === 's3') { + return $this->storage->temporaryUrl($this->path, now()->addMinute()); + } + + return $this->storage->url($this->path); + } +} + diff --git a/config/filepond.php b/config/filepond.php index 9dfd0f0..e347375 100644 --- a/config/filepond.php +++ b/config/filepond.php @@ -20,7 +20,7 @@ | Here you may specify the filesystem disk that should be used. | */ - 'disk' => 'uploads', + 'disk' => env('FILEPOND_DISK', 'uploads'), /* |-------------------------------------------------------------------------- diff --git a/config/filesystems.php b/config/filesystems.php index 6b4e20c..98f5e1f 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -67,6 +67,7 @@ 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_URL'), ], 'uploads' => [