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()
|
public function delete_attachment()
|
||||||
{
|
{
|
||||||
foreach ($this->attachment as $file) {
|
if ($attachments = $this->attachment) {
|
||||||
MediaModel::where('id', $file->id)->delete();
|
foreach ($attachments as $file) {
|
||||||
|
MediaModel::where('id', $file->id)->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user