Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kolirt committed Sep 3, 2024
1 parent 28f9389 commit 2752876
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"fill"
],
"license": "MIT",
"version": "3.0.3",
"version": "3.1.3",
"authors": [
{
"name": "kolirt"
Expand Down
6 changes: 3 additions & 3 deletions src/MasterModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait MasterModel

public $relationsToSave = [];
public $priorityRelationsToSave = [];
public $files = [];
public $saved_file_paths = [];

/**
* Delete the model from the database.
Expand Down Expand Up @@ -82,7 +82,7 @@ public function fill(array $attributes)
$value->move($dir, $imageName);
$file_path = $dir_path . $imageName;
$attributes[$key] = $file_path;
$this->files[] = $file_path;
$this->saved_file_paths[] = $file_path;

try {
$path = $this->$key;
Expand Down Expand Up @@ -215,7 +215,7 @@ public function save(array $options = [])

\DB::commit();
} catch (\Exception $e) {
foreach ($this->files as $file) {
foreach ($this->saved_file_paths as $file) {
try {
$path = $file;
if (file_exists(storage_path($path)) && !is_dir(storage_path($path))) {
Expand Down

0 comments on commit 2752876

Please sign in to comment.