mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Simplify destroy method and update list
This commit is contained in:
parent
eba494ad8c
commit
f58e3114a2
|
@ -523,23 +523,22 @@ class Importer extends Component
|
|||
|
||||
public function destroy($id)
|
||||
{
|
||||
// TODO: why don't we just do File::find($id)? This seems dumb.
|
||||
foreach ($this->files as $file) {
|
||||
if ($id == $file->id) {
|
||||
if (Storage::delete('private_uploads/imports/' . $file->file_path)) {
|
||||
$file->delete();
|
||||
$this->authorize('import');
|
||||
|
||||
$import = Import::findOrFail($id);
|
||||
|
||||
if (Storage::delete('private_uploads/imports/' . $import->file_path)) {
|
||||
$import->delete();
|
||||
$this->message = trans('admin/hardware/message.import.file_delete_success');
|
||||
$this->message_type = 'success';
|
||||
return;
|
||||
} else {
|
||||
$this->message = trans('admin/hardware/message.import.file_delete_error');
|
||||
$this->message_type = 'danger';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->files);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->message = trans('admin/hardware/message.import.file_delete_error');
|
||||
$this->message_type = 'danger';
|
||||
}
|
||||
|
||||
public function clearMessage()
|
||||
|
|
Loading…
Reference in a new issue