mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 12:28:46 +00:00
Code cleanup.
This commit is contained in:
@@ -221,7 +221,7 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
{
|
||||
|
||||
// delete journals:
|
||||
$journals = \TransactionJournal::whereIn(
|
||||
\TransactionJournal::whereIn(
|
||||
'id', function ($query) use ($model) {
|
||||
$query->select('transaction_journal_id')
|
||||
->from('transactions')->whereIn(
|
||||
@@ -454,10 +454,9 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc.
|
||||
*
|
||||
* @param $what
|
||||
*
|
||||
* @throws NotImplementedException
|
||||
* @return \AccountType|null
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
@@ -470,6 +469,7 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
* Returns all objects.
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
@@ -487,6 +487,12 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
return $this->getUser()->accounts()->whereIn('id', $ids)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return static
|
||||
* @throws \FireflyIII\Exception\FireflyException
|
||||
*/
|
||||
public function firstExpenseAccountOrCreate($name)
|
||||
{
|
||||
/** @var \FireflyIII\Database\AccountType $accountTypeRepos */
|
||||
@@ -510,6 +516,12 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return static
|
||||
* @throws \FireflyIII\Exception\FireflyException
|
||||
*/
|
||||
public function firstRevenueAccountOrCreate($name)
|
||||
{
|
||||
/** @var \FireflyIII\Database\AccountType $accountTypeRepos */
|
||||
@@ -523,6 +535,12 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Account $account
|
||||
* @param int $limit
|
||||
*
|
||||
* @return \Illuminate\Pagination\Paginator
|
||||
*/
|
||||
public function getAllTransactionJournals(\Account $account, $limit = 50)
|
||||
{
|
||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||
@@ -568,6 +586,13 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
return $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Account $account
|
||||
* @param int $limit
|
||||
* @param string $range
|
||||
*
|
||||
* @return \Illuminate\Pagination\Paginator
|
||||
*/
|
||||
public function getTransactionJournals(\Account $account, $limit = 50, $range = 'session')
|
||||
{
|
||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||
@@ -580,8 +605,8 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
->orderBy('date', 'DESC');
|
||||
|
||||
if ($range == 'session') {
|
||||
$query->before(\Session::get('end', \Carbon\Carbon::now()->startOfMonth()));
|
||||
$query->after(\Session::get('start', \Carbon\Carbon::now()->startOfMonth()));
|
||||
$query->before(\Session::get('end', Carbon::now()->startOfMonth()));
|
||||
$query->after(\Session::get('start', Carbon::now()->startOfMonth()));
|
||||
}
|
||||
$count = $query->count();
|
||||
$set = $query->take($limit)->offset($offset)->get(['transaction_journals.*']);
|
||||
|
||||
@@ -21,6 +21,7 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
@@ -32,6 +33,7 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
* @param array $data
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -41,9 +43,10 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
|
||||
/**
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
@@ -58,6 +61,7 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
* @param array $model
|
||||
*
|
||||
* @return array
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function validate(array $model)
|
||||
{
|
||||
@@ -71,6 +75,7 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
@@ -115,6 +120,7 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
* Returns all objects.
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
@@ -126,6 +132,7 @@ class AccountType implements CUD, CommonDatabaseCalls
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function getByIds(array $ids)
|
||||
{
|
||||
|
||||
@@ -136,6 +136,7 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
* @param $what
|
||||
*
|
||||
* @return \AccountType|null
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
{
|
||||
@@ -159,6 +160,7 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function getByIds(array $ids)
|
||||
{
|
||||
@@ -200,6 +202,12 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
return \Paginator::make($items, $count, $take);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Budget $budget
|
||||
* @param int $limit
|
||||
*
|
||||
* @return \Illuminate\Pagination\Paginator
|
||||
*/
|
||||
public function getTransactionJournals(\Budget $budget, $limit = 50)
|
||||
{
|
||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||
@@ -214,6 +222,13 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Budget $budget
|
||||
* @param \LimitRepetition $repetition
|
||||
* @param int $limit
|
||||
*
|
||||
* @return \Illuminate\Pagination\Paginator
|
||||
*/
|
||||
public function getTransactionJournalsInRepetition(\Budget $budget, \LimitRepetition $repetition, $limit = 50)
|
||||
{
|
||||
$start = $repetition->startdate;
|
||||
@@ -241,8 +256,8 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
public function repetitionOnStartingOnDate(\Budget $budget, Carbon $date)
|
||||
{
|
||||
return \LimitRepetition::
|
||||
leftJoin('limits', 'limit_repetitions.limit_id', '=', 'limits.id')->leftJoin(
|
||||
'components', 'limits.component_id', '=', 'components.id'
|
||||
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')->leftJoin(
|
||||
'components', 'budget_limits.component_id', '=', 'components.id'
|
||||
)->where('limit_repetitions.startdate', $date->format('Y-m-d'))->where(
|
||||
'components.id', $budget->id
|
||||
)->first(['limit_repetitions.*']);
|
||||
|
||||
@@ -124,6 +124,7 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
@@ -137,6 +138,7 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
* @param $what
|
||||
*
|
||||
* @return \AccountType|null
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
{
|
||||
@@ -158,6 +160,7 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function getByIds(array $ids)
|
||||
{
|
||||
@@ -165,11 +168,22 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function firstOrCreate($name)
|
||||
{
|
||||
return \Category::firstOrCreate(['user_id' => $this->getUser()->id, 'name' => $name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Category $category
|
||||
* @param int $limit
|
||||
*
|
||||
* @return \Illuminate\Pagination\Paginator
|
||||
*/
|
||||
public function getTransactionJournals(\Category $category, $limit = 50)
|
||||
{
|
||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||
@@ -185,10 +199,11 @@ class Category implements CUD, CommonDatabaseCalls
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Category $budget
|
||||
* @param \Category $category
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return null
|
||||
* @internal param \Category $budget
|
||||
*/
|
||||
public function repetitionOnStartingOnDate(\Category $category, Carbon $date)
|
||||
{
|
||||
|
||||
@@ -13,10 +13,13 @@ interface RecurringInterface
|
||||
{
|
||||
/**
|
||||
* @param \RecurringTransaction $recurring
|
||||
* @param Carbon $current
|
||||
* @param Carbon $currentEnd
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return null|\TransactionJournal
|
||||
* @internal param Carbon $current
|
||||
* @internal param Carbon $currentEnd
|
||||
*
|
||||
* @return \TransactionJournal|null
|
||||
*/
|
||||
public function getJournalForRecurringInRange(\RecurringTransaction $recurring, Carbon $start, Carbon $end);
|
||||
|
||||
|
||||
@@ -5,6 +5,11 @@ namespace FireflyIII\Database\Ifaces;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Interface ReportInterface
|
||||
*
|
||||
* @package FireflyIII\Database\Ifaces
|
||||
*/
|
||||
interface ReportInterface
|
||||
{
|
||||
|
||||
|
||||
@@ -203,6 +203,7 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
* @param $what
|
||||
*
|
||||
* @return \AccountType|null
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
{
|
||||
@@ -224,6 +225,7 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function getByIds(array $ids)
|
||||
{
|
||||
@@ -231,7 +233,16 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
public function findRepetitionByDate(\Piggybank $piggybank, Carbon $date)
|
||||
/**
|
||||
* @param \Piggybank $piggybank
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return mixed
|
||||
* @throws FireflyException
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findRepetitionByDate(\Piggybank $piggybank, /** @noinspection PhpUnusedParameterInspection */
|
||||
Carbon $date)
|
||||
{
|
||||
$reps = $piggybank->piggybankrepetitions()->get();
|
||||
if ($reps->count() == 1) {
|
||||
|
||||
@@ -183,6 +183,7 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
@@ -196,6 +197,7 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
* @param $what
|
||||
*
|
||||
* @return \AccountType|null
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
{
|
||||
@@ -217,6 +219,7 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function getByIds(array $ids)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,11 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
|
||||
/**
|
||||
* Class RepeatedExpense
|
||||
*
|
||||
* @package FireflyIII\Database
|
||||
*/
|
||||
class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
{
|
||||
use SwitchUser;
|
||||
@@ -30,6 +35,8 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
* other variables this method tries to divide the piggy bank into equal parts. Each is
|
||||
* accommodated by a reminder (if everything goes to plan).
|
||||
*
|
||||
* @param \PiggybankRepetition $repetition
|
||||
*
|
||||
* @return \PiggybankRepetition
|
||||
*/
|
||||
public function calculateParts(\PiggybankRepetition $repetition)
|
||||
@@ -98,7 +105,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
foreach ($bars as $index => $bar) {
|
||||
$bar->setAmountPerBar($amountPerBar);
|
||||
$bar->setCumulativeAmount($cumulative);
|
||||
if($parts -1 == $index) {
|
||||
if ($parts - 1 == $index) {
|
||||
$bar->setCumulativeAmount($piggyBank->targetamount);
|
||||
}
|
||||
|
||||
@@ -275,6 +282,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
@@ -316,9 +324,10 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
|
||||
/**
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
@@ -426,6 +435,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
@@ -439,6 +449,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
* @param $what
|
||||
*
|
||||
* @return \AccountType|null
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
{
|
||||
@@ -460,6 +471,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function getByIds(array $ids)
|
||||
{
|
||||
@@ -471,6 +483,7 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
* @param \Account $account
|
||||
*
|
||||
* @return float
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function leftOnAccount(\Account $account)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,11 @@ namespace FireflyIII\Database;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Database\Ifaces\ReportInterface;
|
||||
|
||||
/**
|
||||
* Class Report
|
||||
*
|
||||
* @package FireflyIII\Database
|
||||
*/
|
||||
class Report implements ReportInterface
|
||||
{
|
||||
use SwitchUser;
|
||||
|
||||
@@ -24,6 +24,7 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
@@ -35,6 +36,7 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
* @param array $data
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -59,9 +61,10 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
|
||||
/**
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
@@ -141,6 +144,7 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
@@ -154,6 +158,7 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
* @param $what
|
||||
*
|
||||
* @return \AccountType|null
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
{
|
||||
@@ -165,6 +170,7 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
* Returns all objects.
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
@@ -176,6 +182,7 @@ class Transaction implements CUD, CommonDatabaseCalls
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function getByIds(array $ids)
|
||||
{
|
||||
|
||||
@@ -58,6 +58,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
* @param array $data
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -174,6 +175,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
@@ -186,9 +188,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
/** @var \FireflyIII\Database\TransactionCurrency $currencyRepository */
|
||||
$currencyRepository = \App::make('FireflyIII\Database\TransactionCurrency');
|
||||
|
||||
/** @var \FireflyIII\Database\Transaction $transactionRepository */
|
||||
$transactionRepository = \App::make('FireflyIII\Database\Transaction');
|
||||
|
||||
$journalType = $typeRepository->findByWhat($data['what']);
|
||||
$currency = $currencyRepository->findByCode($data['currency']);
|
||||
|
||||
@@ -284,6 +283,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
* @param array $model
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function validate(array $model)
|
||||
{
|
||||
@@ -350,7 +350,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
/*
|
||||
* Many checks to catch invalid or not-existing accounts.
|
||||
*/
|
||||
$accountError = false;
|
||||
switch (true) {
|
||||
// this combination is often seen in withdrawals.
|
||||
case (isset($model['account_id']) && isset($model['expense_account'])):
|
||||
@@ -458,6 +457,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
* @param $what
|
||||
*
|
||||
* @return \AccountType|null
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
{
|
||||
@@ -560,6 +560,11 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
return $sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $limit
|
||||
*
|
||||
* @return \Illuminate\Pagination\Paginator
|
||||
*/
|
||||
public function getDepositsPaginated($limit = 50)
|
||||
{
|
||||
$offset = intval(\Input::get('page')) > 0 ? (intval(\Input::get('page')) - 1) * $limit : 0;
|
||||
@@ -599,6 +604,11 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $limit
|
||||
*
|
||||
* @return \Illuminate\Pagination\Paginator
|
||||
*/
|
||||
public function getTransfersPaginated($limit = 50)
|
||||
{
|
||||
$offset = intval(\Input::get('page')) > 0 ? (intval(\Input::get('page')) - 1) * $limit : 0;
|
||||
@@ -615,6 +625,11 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $limit
|
||||
*
|
||||
* @return \Illuminate\Pagination\Paginator
|
||||
*/
|
||||
public function getWithdrawalsPaginated($limit = 50)
|
||||
{
|
||||
$offset = intval(\Input::get('page')) > 0 ? (intval(\Input::get('page')) - 1) * $limit : 0;
|
||||
|
||||
@@ -23,6 +23,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
* @param \Eloquent $model
|
||||
*
|
||||
* @return bool
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function destroy(\Eloquent $model)
|
||||
{
|
||||
@@ -34,6 +35,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
* @param array $data
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
@@ -43,9 +45,10 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
|
||||
/**
|
||||
* @param \Eloquent $model
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return bool
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function update(\Eloquent $model, array $data)
|
||||
{
|
||||
@@ -60,6 +63,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
* @param array $model
|
||||
*
|
||||
* @return array
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function validate(array $model)
|
||||
{
|
||||
@@ -73,6 +77,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Eloquent
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function find($id)
|
||||
{
|
||||
@@ -86,6 +91,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
* @param $what
|
||||
*
|
||||
* @return \AccountType|null
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function findByWhat($what)
|
||||
{
|
||||
@@ -114,6 +120,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
* Returns all objects.
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
@@ -125,6 +132,7 @@ class TransactionType implements CUD, CommonDatabaseCalls
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
* @throws NotImplementedException
|
||||
*/
|
||||
public function getByIds(array $ids)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user