Use trait and interface.

This commit is contained in:
James Cole
2025-02-23 12:28:27 +01:00
parent 79ae110368
commit de8149137a
32 changed files with 165 additions and 343 deletions

View File

@@ -28,8 +28,8 @@ use FireflyIII\Factory\AttachmentFactory;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Note;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable;
use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Storage;
@@ -38,10 +38,9 @@ use League\Flysystem\UnableToDeleteFile;
/**
* Class AttachmentRepository.
*/
class AttachmentRepository implements AttachmentRepositoryInterface
class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupInterface
{
/** @var User */
private $user;
use UserGroupTrait;
/**
* @throws \Exception
@@ -126,13 +125,6 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return $result;
}
public function setUser(null|Authenticatable|User $user): void
{
if ($user instanceof User) {
$this->user = $user;
}
}
public function update(Attachment $attachment, array $data): Attachment
{
if (array_key_exists('title', $data)) {