Allow to edit an attachment.

This commit is contained in:
James Cole
2015-07-19 09:37:28 +02:00
parent b5e2e8aa1d
commit 0dbe4e94fa
9 changed files with 290 additions and 23 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace FireflyIII\Repositories\Attachment;
use FireflyIII\Models\Attachment;
/**
* Class AttachmentRepository
*
* @package FireflyIII\Repositories\Attachment
*/
class AttachmentRepository implements AttachmentRepositoryInterface
{
/**
* @param Attachment $attachment
* @param array $data
*
* @return Attachment
*/
public function update(Attachment $attachment, array $data)
{
$attachment->title = $data['title'];
$attachment->description = $data['description'];
$attachment->notes = $data['notes'];
$attachment->save();
return $attachment;
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace FireflyIII\Repositories\Attachment;
use FireflyIII\Models\Attachment;
/**
* Interface AttachmentRepositoryInterface
*
* @package FireflyIII\Repositories\Attachment
*/
interface AttachmentRepositoryInterface
{
/**
* @param Attachment $attachment
* @param array $attachmentData
*
* @return Attachment
*/
public function update(Attachment $attachment, array $attachmentData);
}