chore: code cleanup.

This commit is contained in:
James Cole
2023-05-29 13:56:55 +02:00
parent 7f7644c92f
commit 1b52147a05
295 changed files with 12418 additions and 12324 deletions

View File

@@ -55,14 +55,6 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
$availableBudget->delete();
}
/**
* @inheritDoc
*/
public function findById(int $id): ?AvailableBudget
{
return $this->user->availableBudgets->find($id);
}
/**
* Find existing AB.
*
@@ -81,6 +73,37 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
->first();
}
/**
* @inheritDoc
*/
public function findById(int $id): ?AvailableBudget
{
return $this->user->availableBudgets->find($id);
}
/**
* Return a list of all available budgets (in all currencies) (for the selected period).
*
* @param Carbon|null $start
* @param Carbon|null $end
*
* @return Collection
*/
public function get(?Carbon $start = null, ?Carbon $end = null): Collection
{
$query = $this->user->availableBudgets()->with(['transactionCurrency']);
if (null !== $start && null !== $end) {
$query->where(
static function (Builder $q1) use ($start, $end) {
$q1->where('start_date', '=', $start->format('Y-m-d'));
$q1->where('end_date', '=', $end->format('Y-m-d'));
}
);
}
return $query->get(['available_budgets.*']);
}
/**
* @param TransactionCurrency $currency
* @param Carbon $start
@@ -122,29 +145,6 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
return $return;
}
/**
* Return a list of all available budgets (in all currencies) (for the selected period).
*
* @param Carbon|null $start
* @param Carbon|null $end
*
* @return Collection
*/
public function get(?Carbon $start = null, ?Carbon $end = null): Collection
{
$query = $this->user->availableBudgets()->with(['transactionCurrency']);
if (null !== $start && null !== $end) {
$query->where(
static function (Builder $q1) use ($start, $end) {
$q1->where('start_date', '=', $start->format('Y-m-d'));
$q1->where('end_date', '=', $end->format('Y-m-d'));
}
);
}
return $query->get(['available_budgets.*']);
}
/**
* Returns all available budget objects.
*