Simplified export.

This commit is contained in:
James Cole
2016-10-23 09:44:14 +02:00
parent 3c0c15103e
commit bcd7b41c91
19 changed files with 562 additions and 561 deletions

View File

@@ -13,6 +13,7 @@ declare(strict_types = 1);
namespace FireflyIII\Repositories\Attachment;
use Carbon\Carbon;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Models\Attachment;
use FireflyIII\User;
@@ -63,6 +64,24 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return $this->user->attachments()->get();
}
/**
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getBetween(Carbon $start, Carbon $end): Collection
{
$query = $this->user
->attachments()
->leftJoin('transaction_journals', 'attachments.attachable_id', '=', 'transaction_journals.id')
->where('transaction_journals.date', '>=', $start->format('Y-m-d'))
->where('transaction_journals.date', '<=', $end->format('Y-m-d'))
->get(['attachments.*']);
return $query;
}
/**
* @param Attachment $attachment
* @param array $data

View File

@@ -13,6 +13,7 @@ declare(strict_types = 1);
namespace FireflyIII\Repositories\Attachment;
use Carbon\Carbon;
use FireflyIII\Models\Attachment;
use Illuminate\Support\Collection;
@@ -36,6 +37,14 @@ interface AttachmentRepositoryInterface
*/
public function get(): Collection;
/**
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getBetween(Carbon $start, Carbon $end): Collection;
/**
* @param Attachment $attachment
* @param array $attachmentData