Delete attachment's file on disk

This commit is contained in:
Burak Çakırel 2021-06-17 16:40:12 +03:00
parent 873d25c742
commit 9dd1c92c6f
No known key found for this signature in database
GPG Key ID: 48FFBB7771B99C7C
2 changed files with 7 additions and 7 deletions

View File

@ -27,11 +27,11 @@ class Uploads extends Controller
}
// Get file path
if (!$path = $this->getMediaPathOnStorage($media)) {
if (!$this->getMediaPathOnStorage($media)) {
return response(null, 204);
}
return $this->streamMedia($media, $path);
return $this->streamMedia($media);
}
/**
@ -70,7 +70,7 @@ class Uploads extends Controller
}
// Get file path
if (!$path = $this->getMediaPathOnStorage($media)) {
if (!$this->getMediaPathOnStorage($media)) {
return response()->json([
'success' => false,
'error' => true,
@ -108,11 +108,11 @@ class Uploads extends Controller
}
// Get file path
if (!$path = $this->getMediaPathOnStorage($media)) {
if (!$this->getMediaPathOnStorage($media)) {
return false;
}
return $this->streamMedia($media, $path);
return $this->streamMedia($media);
}
/**

View File

@ -100,10 +100,10 @@ trait Uploads
return false;
}
return Storage::path($path);
return $path;
}
public function streamMedia($media, $path = '')
public function streamMedia($media)
{
return response()->streamDownload(
function() use ($media) {