mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
New converters for #180 (Budget)
This commit is contained in:
@@ -74,6 +74,23 @@ class BudgetRepository extends ComponentRepository implements BudgetRepositoryIn
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a budget.
|
||||
*
|
||||
* @param int $budgetId
|
||||
*
|
||||
* @return Budget
|
||||
*/
|
||||
public function find(int $budgetId): Budget
|
||||
{
|
||||
$budget = $this->user->budgets()->find($budgetId);
|
||||
if (is_null($budget)) {
|
||||
$budget = new Budget;
|
||||
}
|
||||
|
||||
return $budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Budget $budget
|
||||
*
|
||||
|
@@ -17,7 +17,6 @@ use Illuminate\Support\Collection;
|
||||
interface BudgetRepositoryInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Same as ::spentInPeriod but corrects journals for a set of accounts
|
||||
@@ -43,6 +42,15 @@ interface BudgetRepositoryInterface
|
||||
*/
|
||||
public function destroy(Budget $budget);
|
||||
|
||||
/**
|
||||
* Find a budget.
|
||||
*
|
||||
* @param int $budgetId
|
||||
*
|
||||
* @return Budget
|
||||
*/
|
||||
public function find(int $budgetId): Budget;
|
||||
|
||||
/**
|
||||
* @param Budget $budget
|
||||
*
|
||||
|
Reference in New Issue
Block a user