Lots of new code for importer and some preferences.

This commit is contained in:
James Cole
2016-07-24 18:47:55 +02:00
parent 87c0f1d86e
commit 1392275b81
41 changed files with 1562 additions and 369 deletions

View File

@@ -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;
}
}