Skip to content

Commit

Permalink
Add Check before deleting a profile photo (#959)
Browse files Browse the repository at this point in the history
* Add Check before deleting a profile photo

* Formatting

* Update HasProfilePhoto.php

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
Jubeki and taylorotwell authored Jan 19, 2022
1 parent 852d0ab commit fec0bae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/HasProfilePhoto.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public function deleteProfilePhoto()
return;
}

if (is_null($this->profile_photo_path)) {
return;
}

Storage::disk($this->profilePhotoDisk())->delete($this->profile_photo_path);

$this->forceFill([
Expand Down

0 comments on commit fec0bae

Please sign in to comment.