Update DeleteAccountPipeline

This commit is contained in:
Daniel Supernault 2019-04-21 23:38:34 -06:00
parent 9c83451831
commit fae385989e
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -8,6 +8,7 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use DB; use DB;
use Illuminate\Support\Str;
use App\{ use App\{
AccountLog, AccountLog,
Activity, Activity,
@ -74,11 +75,15 @@ class DeleteAccountPipeline implements ShouldQueue
$avatar = $user->profile->avatar; $avatar = $user->profile->avatar;
if(is_file($avatar->media_path)) { if(is_file($avatar->media_path)) {
unlink($avatar->media_path); if($avatar->media_path != 'public/avatars/default.png') {
unlink($avatar->media_path);
}
} }
if(is_file($avatar->thumb_path)) { if(is_file($avatar->thumb_path)) {
unlink($avatar->thumb_path); if($avatar->thumb_path != 'public/avatars/default.png') {
unlink($avatar->thumb_path);
}
} }
$avatar->forceDelete(); $avatar->forceDelete();
} }