From 6112eec458e35d6ed5b507e163aed1c9436a4616 Mon Sep 17 00:00:00 2001 From: merdan Date: Fri, 27 Mar 2020 19:12:56 +0500 Subject: [PATCH] Venues public ready for Test --- app/Models/Venue.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Venue.php b/app/Models/Venue.php index 8e09c712..24581d88 100644 --- a/app/Models/Venue.php +++ b/app/Models/Venue.php @@ -141,7 +141,6 @@ class Venue extends Model // if a file has been marked for removal, // delete it from the disk and from the db if ($files_to_clear) { - $attribute_value = (array) $this->{$attribute_name}; foreach ($files_to_clear as $key => $filename) { \Storage::disk($disk)->delete($filename); $attribute_value = array_where($attribute_value, function ($value, $key) use ($filename) { @@ -152,9 +151,10 @@ class Venue extends Model // if a new file is uploaded, store it on disk and its filename in the database if ($request->hasFile($attribute_name)) { foreach ($request->file($attribute_name) as $file) { + dd($value); if ($file->isValid()) { // 1. Generate a new file name - $new_file_name = md5($value.time()).'.jpg'; + $new_file_name = md5($file.time()).'.jpg'; // 2. Move the new file to the correct path $file_path = $file->storeAs($destination_path, $new_file_name, $disk); // 3. Add the public path to the database