API can deal with attachments for more models. #2828

This commit is contained in:
James Cole
2020-03-19 08:32:42 +01:00
parent 3246b7eb9f
commit 75afe35e98
21 changed files with 277 additions and 4 deletions

View File

@@ -645,4 +645,12 @@ class AccountRepository implements AccountRepositoryInterface
{
return $account->locations()->first();
}
/**
* @inheritDoc
*/
public function getAttachments(Account $account): Collection
{
return $account->attachments()->get();
}
}

View File

@@ -47,6 +47,13 @@ interface AccountRepositoryInterface
*/
public function count(array $types): int;
/**
* @param Account $account
*
* @return Collection
*/
public function getAttachments(Account $account): Collection;
/**
* Get account location, if any.
*

View File

@@ -479,4 +479,12 @@ class BudgetRepository implements BudgetRepositoryInterface
$autoBudget->delete();
}
}
/**
* @inheritDoc
*/
public function getAttachments(Budget $budget): Collection
{
return $budget->attachments()->get();
}
}

View File

@@ -39,6 +39,13 @@ interface BudgetRepositoryInterface
*/
public function destroyAll(): void;
/**
* @param Budget $budget
*
* @return Collection
*/
public function getAttachments(Budget $budget): Collection;
/**
* @param Budget $budget
*

View File

@@ -373,4 +373,12 @@ class CategoryRepository implements CategoryRepositoryInterface
$category->delete();
}
}
/**
* @inheritDoc
*/
public function getAttachments(Category $category): Collection
{
return $category->attachments()->get();
}
}

View File

@@ -38,6 +38,13 @@ interface CategoryRepositoryInterface
*/
public function destroyAll(): void;
/**
* @param Category $category
*
* @return Collection
*/
public function getAttachments(Category $category): Collection;
/**
* @param Category $category
*

View File

@@ -680,4 +680,12 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
return true;
}
/**
* @inheritDoc
*/
public function getAttachments(PiggyBank $piggyBank): Collection
{
return $piggyBank->attachments()->get();
}
}

View File

@@ -44,6 +44,13 @@ interface PiggyBankRepositoryInterface
*/
public function setCurrentAmount(PiggyBank $piggyBank, string $amount): PiggyBank;
/**
* @param PiggyBank $piggyBank
*
* @return Collection
*/
public function getAttachments(PiggyBank $piggyBank): Collection;
/**
* @param PiggyBank $piggyBank
* @param string $amount

View File

@@ -539,4 +539,12 @@ class TagRepository implements TagRepositoryInterface
return $min;
}
/**
* @inheritDoc
*/
public function getAttachments(Tag $tag): Collection
{
return $tag->attachments()->get();
}
}

View File

@@ -39,6 +39,13 @@ interface TagRepositoryInterface
*/
public function count(): int;
/**
* @param Tag $tag
*
* @return Collection
*/
public function getAttachments(Tag $tag): Collection;
/**
* This method destroys a tag.
*