mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Move method to correct repository.
This commit is contained in:
@@ -110,7 +110,7 @@ class AvailableBudgetController extends Controller
|
|||||||
$end = $this->parameters->get('end');
|
$end = $this->parameters->get('end');
|
||||||
|
|
||||||
// get list of available budgets. Count it and split it.
|
// get list of available budgets. Count it and split it.
|
||||||
$collection = $this->repository->getAvailableBudgetsByDate($start, $end);
|
$collection = $this->abRepository->getAvailableBudgetsByDate($start, $end);
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
$availableBudgets = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
$availableBudgets = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||||
|
|
||||||
|
@@ -84,18 +84,6 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all available budget objects.
|
|
||||||
*
|
|
||||||
* @param TransactionCurrency $currency
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getAvailableBudgetsByCurrency(TransactionCurrency $currency): Collection
|
|
||||||
{
|
|
||||||
return $this->user->availableBudgets()->where('transaction_currency_id', $currency->id)->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
@@ -116,6 +104,41 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all available budget objects.
|
||||||
|
*
|
||||||
|
* @param TransactionCurrency $currency
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function getAvailableBudgetsByCurrency(TransactionCurrency $currency): Collection
|
||||||
|
{
|
||||||
|
return $this->user->availableBudgets()->where('transaction_currency_id', $currency->id)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all available budget objects.
|
||||||
|
*
|
||||||
|
* @param Carbon|null $start
|
||||||
|
* @param Carbon|null $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function getAvailableBudgetsByDate(?Carbon $start, ?Carbon $end): Collection
|
||||||
|
{
|
||||||
|
$query = $this->user->availableBudgets();
|
||||||
|
|
||||||
|
if (null !== $start) {
|
||||||
|
$query->where('start_date', '>=', $start->format('Y-m-d H:i:s'));
|
||||||
|
}
|
||||||
|
if (null !== $end) {
|
||||||
|
$query->where('end_date', '<=', $end->format('Y-m-d H:i:s'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->get();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
|
@@ -65,6 +65,17 @@ interface AvailableBudgetRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getAvailableBudgetsByCurrency(TransactionCurrency $currency): Collection;
|
public function getAvailableBudgetsByCurrency(TransactionCurrency $currency): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all available budget objects.
|
||||||
|
*
|
||||||
|
* @param Carbon|null $start
|
||||||
|
* @param Carbon|null $end
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function getAvailableBudgetsByDate(?Carbon $start, ?Carbon $end): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
|
@@ -209,29 +209,6 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all available budget objects.
|
|
||||||
*
|
|
||||||
* @param Carbon|null $start
|
|
||||||
* @param Carbon|null $end
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function getAvailableBudgetsByDate(?Carbon $start, ?Carbon $end): Collection
|
|
||||||
{
|
|
||||||
$query = $this->user->availableBudgets();
|
|
||||||
|
|
||||||
if (null !== $start) {
|
|
||||||
$query->where('start_date', '>=', $start->format('Y-m-d H:i:s'));
|
|
||||||
}
|
|
||||||
if (null !== $end) {
|
|
||||||
$query->where('end_date', '<=', $end->format('Y-m-d H:i:s'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
|
@@ -88,17 +88,6 @@ interface BudgetRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getActiveBudgets(): Collection;
|
public function getActiveBudgets(): Collection;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all available budget objects.
|
|
||||||
*
|
|
||||||
* @param Carbon|null $start
|
|
||||||
* @param Carbon|null $end
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function getAvailableBudgetsByDate(?Carbon $start, ?Carbon $end): Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
|
Reference in New Issue
Block a user