add document attachment multiple

This commit is contained in:
Cüneyt Şentürk
2021-01-22 12:38:17 +03:00
parent e2a2723e28
commit f13677e0a3
7 changed files with 34 additions and 20 deletions

View File

@ -3,6 +3,7 @@
namespace App\Models\Document;
use App\Abstracts\Model;
use App\Models\Common\Media as MediaModel;
use App\Models\Setting\Tax;
use App\Scopes\Document as Scope;
use App\Traits\Currencies;
@ -224,7 +225,14 @@ class Document extends Model
return false;
}
return $this->getMedia('attachment')->last();
return $this->getMedia('attachment')->all();
}
public function delete_attachment()
{
foreach ($this->attachment as $file) {
MediaModel::where('id', $file->id)->delete();
}
}
/**