mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Lots of new code for importer and some preferences.
This commit is contained in:
@@ -23,7 +23,6 @@ use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class BudgetRepository
|
||||
@@ -86,6 +85,26 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
return $budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a budget.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Budget
|
||||
*/
|
||||
public function findByName(string $name): Budget
|
||||
{
|
||||
$budgets = $this->user->budgets()->get();
|
||||
/** @var Budget $budget */
|
||||
foreach ($budgets as $budget) {
|
||||
if ($budget->name === $name) {
|
||||
return $budget;
|
||||
}
|
||||
}
|
||||
|
||||
return new Budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the oldest journal or transaction date known to this budget.
|
||||
* Will cache result.
|
||||
@@ -499,5 +518,4 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
|
||||
return $limit;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user