existence of attachment must be checked
This commit is contained in:
parent
cd42769029
commit
2448943a46
@ -227,8 +227,10 @@ class Document extends Model
|
||||
|
||||
public function delete_attachment()
|
||||
{
|
||||
foreach ($this->attachment as $file) {
|
||||
MediaModel::where('id', $file->id)->delete();
|
||||
if ($attachments = $this->attachment) {
|
||||
foreach ($attachments as $file) {
|
||||
MediaModel::where('id', $file->id)->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user