getAttachmentLocation($attachment); unlink($file); $attachment->delete(); return true; } /** * @param Attachment $attachment * @param array $data * * @return Attachment */ public function update(Attachment $attachment, array $data): Attachment { $attachment->title = $data['title']; $attachment->description = $data['description']; $attachment->notes = $data['notes']; $attachment->save(); return $attachment; } }