Also delete attachments.

This commit is contained in:
James Cole
2015-07-19 09:53:58 +02:00
parent fb722f06b9
commit f5fb6c063b
6 changed files with 100 additions and 2 deletions

View File

@@ -29,4 +29,19 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return $attachment;
}
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment)
{
/** @var \FireflyIII\Helpers\Attachments\AttachmentHelperInterface $helper */
$helper = app('FireflyIII\Helpers\Attachments\AttachmentHelperInterface');
$file = $helper->getAttachmentLocation($attachment);
unlink($file);
$attachment->delete();
}
}

View File

@@ -19,4 +19,12 @@ interface AttachmentRepositoryInterface
* @return Attachment
*/
public function update(Attachment $attachment, array $attachmentData);
/**
* @param Attachment $attachment
*
* @return bool
*/
public function destroy(Attachment $attachment);
}