Adapted attachment repository.

This commit is contained in:
James Cole 2016-03-03 08:38:24 +01:00
parent d9eb14d6e5
commit 13bac92a24
2 changed files with 17 additions and 3 deletions

View File

@ -45,7 +45,7 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function __construct(User $user)
{
Log::debug('Constructed for user #' . $user->id . ' (' . $user->email . ')');
Log::debug('Constructed account repository for user #' . $user->id . ' (' . $user->email . ')');
$this->user = $user;
}

View File

@ -3,9 +3,10 @@ declare(strict_types = 1);
namespace FireflyIII\Repositories\Attachment;
use Auth;
use FireflyIII\Models\Attachment;
use FireflyIII\User;
use Illuminate\Support\Collection;
use Log;
/**
* Class AttachmentRepository
@ -14,6 +15,19 @@ use Illuminate\Support\Collection;
*/
class AttachmentRepository implements AttachmentRepositoryInterface
{
/** @var User */
private $user;
/**
* AttachmentRepository constructor.
*
* @param User $user
*/
public function __construct(User $user)
{
Log::debug('Constructed attachment repository for user #' . $user->id . ' (' . $user->email . ')');
$this->user = $user;
}
/**
* @param Attachment $attachment
@ -37,7 +51,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
*/
public function get(): Collection
{
return Auth::user()->attachments()->get();
return $this->user->attachments()->get();
}
/**