From 07bfbb3921ce8553a51edd1fb7e01e3ed2b60f2e Mon Sep 17 00:00:00 2001 From: Seth Sharp Date: Sun, 7 Apr 2024 15:58:34 +1000 Subject: [PATCH] adjust how cover image storage works --- src/Actions/Blogs/StoreBlogCoverAction.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Actions/Blogs/StoreBlogCoverAction.php b/src/Actions/Blogs/StoreBlogCoverAction.php index 035e469..babeb1c 100644 --- a/src/Actions/Blogs/StoreBlogCoverAction.php +++ b/src/Actions/Blogs/StoreBlogCoverAction.php @@ -14,7 +14,9 @@ public function __invoke(UploadedFile $file, int $blogId, string $path = '/cover $structure = app()->environment('testing') || app()->environment('local') ? config('blog-crud.bucket_paths.local') : config('blog-crud.bucket_paths.production'); - $path = $structure . 'blogs/' . $blogId . '/cover-image.' . $file->getClientOriginalExtension(); + $filename = uniqid() . '_' . $file->getClientOriginalName(); + + $path = $structure . 'blogs/' . $blogId . '/cover-images/' . $filename; Storage::disk('s3')->put($path, $newFile);