Skip to content

Commit

Permalink
Get at the file attribute value using original
Browse files Browse the repository at this point in the history
  • Loading branch information
weotch committed Jan 22, 2016
1 parent aa60ab3 commit 091a03b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ public function onDeleted(Model $model) {
if (!$this->supportsUploads($model)
|| !($attributes = $model->getUploadAttributes())) return;

// Loop through the all of the upload attributes ...
// Loop through the all of the upload attributes and get the values using
// "original" so that you get the file value before it may have been cleared.
foreach($attributes as $attribute) {
if (!$url = $model->getAttribute($attribute)) continue;
if (!$url = $model->getOriginal($attribute)) continue;
$this->storage->delete($url);
}

Expand Down

0 comments on commit 091a03b

Please sign in to comment.