mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Delete file from assets folder, not just the ref. (#9525)
This commit is contained in:
parent
57b9b571dc
commit
a6bbe1fec3
|
@ -110,15 +110,15 @@ class AssetFilesController extends Controller
|
||||||
{
|
{
|
||||||
$asset = Asset::find($assetId);
|
$asset = Asset::find($assetId);
|
||||||
$this->authorize('update', $asset);
|
$this->authorize('update', $asset);
|
||||||
$rel_path = 'storage/private_uploads/assets';
|
$rel_path = 'private_uploads/assets';
|
||||||
|
|
||||||
// the asset is valid
|
// the asset is valid
|
||||||
if (isset($asset->id)) {
|
if (isset($asset->id)) {
|
||||||
$this->authorize('update', $asset);
|
$this->authorize('update', $asset);
|
||||||
$log = Actionlog::find($fileId);
|
$log = Actionlog::find($fileId);
|
||||||
if ($log) {
|
if ($log) {
|
||||||
if (file_exists(base_path().'/'.$rel_path.'/'.$log->filename)) {
|
if (Storage::exists($rel_path.'/'.$log->filename)) {
|
||||||
Storage::disk('public')->delete($rel_path.'/'.$log->filename);
|
Storage::delete($rel_path.'/'.$log->filename);
|
||||||
}
|
}
|
||||||
$log->delete();
|
$log->delete();
|
||||||
return redirect()->back()->with('success', trans('admin/hardware/message.deletefile.success'));
|
return redirect()->back()->with('success', trans('admin/hardware/message.deletefile.success'));
|
||||||
|
|
Loading…
Reference in a new issue