Merge pull request #2114 from burakcakirel/delete-attachments
Delete attachment's file on disk
This commit is contained in:
commit
c45d7f596f
@ -27,11 +27,11 @@ class Uploads extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get file path
|
// Get file path
|
||||||
if (!$path = $this->getMediaPathOnStorage($media)) {
|
if (!$this->getMediaPathOnStorage($media)) {
|
||||||
return response(null, 204);
|
return response(null, 204);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->streamMedia($media, $path);
|
return $this->streamMedia($media);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +70,7 @@ class Uploads extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get file path
|
// Get file path
|
||||||
if (!$path = $this->getMediaPathOnStorage($media)) {
|
if (!$this->getMediaPathOnStorage($media)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'error' => true,
|
'error' => true,
|
||||||
@ -108,11 +108,11 @@ class Uploads extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get file path
|
// Get file path
|
||||||
if (!$path = $this->getMediaPathOnStorage($media)) {
|
if (!$this->getMediaPathOnStorage($media)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->streamMedia($media, $path);
|
return $this->streamMedia($media);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,10 +100,10 @@ trait Uploads
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Storage::path($path);
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function streamMedia($media, $path = '')
|
public function streamMedia($media)
|
||||||
{
|
{
|
||||||
return response()->streamDownload(
|
return response()->streamDownload(
|
||||||
function() use ($media) {
|
function() use ($media) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user