Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
pxpm committed Nov 27, 2024
1 parent f9f0c71 commit 67430a5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/app/Library/Uploaders/MultipleFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ public function uploadRepeatableFiles($files, $previousRepeatableValues, $entry
return $fileOrder;
}

protected function hasDeletedFiles($value): bool
public function hasDeletedFiles($value): bool
{
return empty($this->getFilesToDeleteFromRequest()) ? false : true;
}

protected function getEntryAttributeValue(Model $entry)
public function getEntryAttributeValue(Model $entry)
{
$value = $entry->{$this->getAttributeName()};

Expand Down
2 changes: 1 addition & 1 deletion src/app/Library/Uploaders/SingleBase64Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function uploadRepeatableFiles($values, $previousRepeatableValues, $entry
return $values;
}

protected function shouldUploadFiles($value): bool
public function shouldUploadFiles($value): bool
{
return $value && is_string($value) && Str::startsWith($value, 'data:image');
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/Library/Uploaders/SingleFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public function shouldKeepPreviousValueUnchanged(Model $entry, $entryValue): boo
return is_string($entryValue);
}

protected function hasDeletedFiles($entryValue): bool
public function hasDeletedFiles($entryValue): bool
{
return $entryValue === null;
}

protected function shouldUploadFiles($value): bool
public function shouldUploadFiles($value): bool
{
return is_a($value, 'Illuminate\Http\UploadedFile', true);
}
Expand Down
5 changes: 0 additions & 5 deletions src/app/Library/Uploaders/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,6 @@ public function getFakeAttribute(): bool|string
return $this->attachedToFakeField;
}

public function shouldKeepPreviousValueUnchanged(Model $entry, $entryValue): bool
{
return $entry->exists && ($entryValue === null || $entryValue === [null]);
}

/*******************************
* Setters - fluently configure the uploader
*******************************/
Expand Down

0 comments on commit 67430a5

Please sign in to comment.