deleting attachments when master / sub task is deleted

This commit is contained in:
StudioTem committed 2023-02-14 09:15:04 +01:00
1 parent 17ed7616ee
commit f35cd29071
4 files changed
+59 -3

No files matched your search

+11
View File
@@ -53,4 +53,15 @@ class MasterTask extends Model
// return random value from array
return collect(['#E9FFE5', '#F6ECD3', '#FDE1FF', '#FFC9C9', '#DADEF8', '#EDFFFE'])->random();
}
public function deleteAttachments()
{
foreach ( $this->attachments as $attachment ) {
$attachment->deleteFromS3();
}
$this->attachments()->delete();
return true;
}
}