mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-23 23:13:18 -06:00
Code cleanup.
This commit is contained in:
parent
82c9a75578
commit
314abbea8b
@ -46,8 +46,8 @@ class AccountController extends BaseController
|
|||||||
public function delete(Account $account)
|
public function delete(Account $account)
|
||||||
{
|
{
|
||||||
return View::make('accounts.delete')->with('account', $account)->with(
|
return View::make('accounts.delete')->with('account', $account)->with(
|
||||||
'subTitle', 'Delete ' . strtolower($account->accountType->type) . ' "' . $account->name . '"'
|
'subTitle', 'Delete ' . strtolower($account->accountType->type) . ' "' . $account->name . '"'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,10 +158,10 @@ class AccountController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return View::make('accounts.edit')->with('account', $account)->with('openingBalance', $openingBalance)->with(compact('subTitleIcon'))->with(
|
return View::make('accounts.edit')->with('account', $account)->with('openingBalance', $openingBalance)->with(compact('subTitleIcon'))->with(
|
||||||
'subTitle', 'Edit ' . strtolower(
|
'subTitle', 'Edit ' . strtolower(
|
||||||
$account->accountType->type
|
$account->accountType->type
|
||||||
) . ' "' . $account->name . '"'
|
) . ' "' . $account->name . '"'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,21 +182,21 @@ class AccountController extends BaseController
|
|||||||
case 'asset':
|
case 'asset':
|
||||||
$subTitleIcon = 'fa-money';
|
$subTitleIcon = 'fa-money';
|
||||||
$subTitle = 'Asset accounts';
|
$subTitle = 'Asset accounts';
|
||||||
$accounts = $acct->getAssetAccounts();
|
$accounts = $acct->getAssetAccounts();
|
||||||
break;
|
break;
|
||||||
case 'expense':
|
case 'expense':
|
||||||
$subTitleIcon = 'fa-shopping-cart';
|
$subTitleIcon = 'fa-shopping-cart';
|
||||||
$subTitle = 'Expense accounts';
|
$subTitle = 'Expense accounts';
|
||||||
$accounts = $acct->getExpenseAccounts();
|
$accounts = $acct->getExpenseAccounts();
|
||||||
break;
|
break;
|
||||||
case 'revenue':
|
case 'revenue':
|
||||||
$subTitleIcon = 'fa-download';
|
$subTitleIcon = 'fa-download';
|
||||||
$subTitle = 'Revenue accounts';
|
$subTitle = 'Revenue accounts';
|
||||||
$accounts = $acct->getRevenueAccounts();
|
$accounts = $acct->getRevenueAccounts();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return View::make('accounts.index',compact('what','subTitleIcon','subTitle','accounts'));
|
return View::make('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,9 +228,9 @@ class AccountController extends BaseController
|
|||||||
|
|
||||||
|
|
||||||
//$data = $this->_accounts->show($account, 40);
|
//$data = $this->_accounts->show($account, 40);
|
||||||
return View::make('accounts.show',compact('account','subTitleIcon','journals'))->with('account', $account)->with(
|
return View::make('accounts.show', compact('account', 'subTitleIcon', 'journals'))->with('account', $account)->with(
|
||||||
'subTitle', 'Details for ' . strtolower($account->accountType->type) . ' "' . $account->name . '"'
|
'subTitle', 'Details for ' . strtolower($account->accountType->type) . ' "' . $account->name . '"'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -240,7 +240,7 @@ class AccountController extends BaseController
|
|||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = Input::all();
|
$data = Input::all();
|
||||||
$data['what'] = isset($data['what']) && $data['what'] != '' ? $data['what'] : 'asset';
|
$data['what'] = isset($data['what']) && $data['what'] != '' ? $data['what'] : 'asset';
|
||||||
/** @var \FireflyIII\Database\Account $acct */
|
/** @var \FireflyIII\Database\Account $acct */
|
||||||
$acct = App::make('FireflyIII\Database\Account');
|
$acct = App::make('FireflyIII\Database\Account');
|
||||||
|
@ -206,13 +206,13 @@ class BudgetController extends BaseController
|
|||||||
$limits = [$repetition->limit];
|
$limits = [$repetition->limit];
|
||||||
// get all transaction journals for this budget and limit repetition.
|
// get all transaction journals for this budget and limit repetition.
|
||||||
$journals = [];
|
$journals = [];
|
||||||
$subTitle = $budget->name.' in ' . $repetition->startdate->format('F Y');
|
$subTitle = $budget->name . ' in ' . $repetition->startdate->format('F Y');
|
||||||
$journals = $repos->getTransactionJournalsInRepetition($budget, $repetition, 50);
|
$journals = $repos->getTransactionJournalsInRepetition($budget, $repetition, 50);
|
||||||
}
|
}
|
||||||
$hideBudget = true;
|
$hideBudget = true;
|
||||||
|
|
||||||
|
|
||||||
return View::make('budgets.show', compact('limits', 'budget', 'repetition', 'journals','subTitle','hideBudget'));
|
return View::make('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle', 'hideBudget'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,9 +66,10 @@ class CategoryController extends BaseController
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
/** @var \FireflyIII\Database\Category $repos */
|
/** @var \FireflyIII\Database\Category $repos */
|
||||||
$repos = App::make('FireflyIII\Database\Category');
|
$repos = App::make('FireflyIII\Database\Category');
|
||||||
$categories = $repos->get();
|
$categories = $repos->get();
|
||||||
return View::make('categories.index',compact('categories'));
|
|
||||||
|
return View::make('categories.index', compact('categories'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,7 +86,7 @@ class CategoryController extends BaseController
|
|||||||
|
|
||||||
$journals = $repos->getTransactionJournals($category, 50);
|
$journals = $repos->getTransactionJournals($category, 50);
|
||||||
|
|
||||||
return View::make('categories.show', compact('category','journals','hideCategory'));
|
return View::make('categories.show', compact('category', 'journals', 'hideCategory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,7 +94,7 @@ class CategoryController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
$data = Input::all();
|
$data = Input::all();
|
||||||
/** @var \FireflyIII\Database\Category $repos */
|
/** @var \FireflyIII\Database\Category $repos */
|
||||||
$repos = App::make('FireflyIII\Database\Category');
|
$repos = App::make('FireflyIII\Database\Category');
|
||||||
|
|
||||||
|
@ -481,12 +481,9 @@ class GoogleChartController extends BaseController
|
|||||||
$chart->addColumn('Balance', 'number');
|
$chart->addColumn('Balance', 'number');
|
||||||
$sum = 0;
|
$sum = 0;
|
||||||
|
|
||||||
$set = \DB::table('piggybank_events')
|
$set = \DB::table('piggybank_events')->where('piggybank_id', $piggybank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]);
|
||||||
->where('piggybank_id',$piggybank->id)
|
|
||||||
->groupBy('date')
|
|
||||||
->get(['date',DB::Raw('SUM(`amount`) AS `sum`')]);
|
|
||||||
|
|
||||||
foreach($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$chart->addRow(new Carbon($entry->date), floatval($entry->sum));
|
$chart->addRow(new Carbon($entry->date), floatval($entry->sum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,8 @@ class PiggybankController extends BaseController
|
|||||||
* Flash some data to fill the form.
|
* Flash some data to fill the form.
|
||||||
*/
|
*/
|
||||||
$prefilled = ['name' => $piggybank->name, 'account_id' => $piggybank->account_id, 'targetamount' => $piggybank->targetamount,
|
$prefilled = ['name' => $piggybank->name, 'account_id' => $piggybank->account_id, 'targetamount' => $piggybank->targetamount,
|
||||||
'targetdate' => !is_null($piggybank->targetdate) ? $piggybank->targetdate->format('Y-m-d') : null,'reminder' => $piggybank->reminder, 'remind_me' => intval($piggybank->remind_me) == 1 ? true : false];
|
'targetdate' => !is_null($piggybank->targetdate) ? $piggybank->targetdate->format('Y-m-d') : null, 'reminder' => $piggybank->reminder,
|
||||||
|
'remind_me' => intval($piggybank->remind_me) == 1 ? true : false];
|
||||||
Session::flash('prefilled', $prefilled);
|
Session::flash('prefilled', $prefilled);
|
||||||
|
|
||||||
return View::make('piggybanks.edit', compact('piggybank', 'accounts', 'periods', 'prefilled'))->with('title', 'Piggybanks')->with(
|
return View::make('piggybanks.edit', compact('piggybank', 'accounts', 'periods', 'prefilled'))->with('title', 'Piggybanks')->with(
|
||||||
@ -230,7 +231,7 @@ class PiggybankController extends BaseController
|
|||||||
public function show(Piggybank $piggybank)
|
public function show(Piggybank $piggybank)
|
||||||
{
|
{
|
||||||
|
|
||||||
$events = $piggybank->piggybankevents()->orderBy('date', 'DESC')->orderBy('id','DESC')->get();
|
$events = $piggybank->piggybankevents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->get();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of reminders:
|
* Number of reminders:
|
||||||
@ -281,7 +282,7 @@ class PiggybankController extends BaseController
|
|||||||
/*
|
/*
|
||||||
* Create the relevant repetition per Event.
|
* Create the relevant repetition per Event.
|
||||||
*/
|
*/
|
||||||
Event::fire('piggybank.storePiggybank',[$piggyBank]);
|
Event::fire('piggybank.storePiggybank', [$piggyBank]);
|
||||||
|
|
||||||
Session::flash('success', 'New piggy bank stored!');
|
Session::flash('success', 'New piggy bank stored!');
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
use Carbon\Carbon;
|
|
||||||
use FireflyIII\Exception\FireflyException;
|
use FireflyIII\Exception\FireflyException;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
|
|
||||||
@ -122,7 +121,7 @@ class RecurringController extends BaseController
|
|||||||
$hideRecurring = true;
|
$hideRecurring = true;
|
||||||
|
|
||||||
|
|
||||||
return View::make('recurring.show', compact('journals', 'hideRecurring','finalDate'))->with('recurring', $recurringTransaction)->with(
|
return View::make('recurring.show', compact('journals', 'hideRecurring', 'finalDate'))->with('recurring', $recurringTransaction)->with(
|
||||||
'subTitle', $recurringTransaction->name
|
'subTitle', $recurringTransaction->name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -501,8 +501,8 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
|||||||
$set = $this->getUser()->transactionJournals()->withRelevantData()->leftJoin(
|
$set = $this->getUser()->transactionJournals()->withRelevantData()->leftJoin(
|
||||||
'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'
|
'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'
|
||||||
)->where('transactions.account_id', $account->id)->take($limit)->offset($offset)->before($end)->after($start)->orderBy('date', 'DESC')->get(
|
)->where('transactions.account_id', $account->id)->take($limit)->offset($offset)->before($end)->after($start)->orderBy('date', 'DESC')->get(
|
||||||
['transaction_journals.*']
|
['transaction_journals.*']
|
||||||
);
|
);
|
||||||
$count = $this->getUser()->transactionJournals()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
$count = $this->getUser()->transactionJournals()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->before($end)->after($start)->orderBy('date', 'DESC')->where('transactions.account_id', $account->id)->count();
|
->before($end)->after($start)->orderBy('date', 'DESC')->where('transactions.account_id', $account->id)->count();
|
||||||
$items = [];
|
$items = [];
|
||||||
|
@ -198,10 +198,12 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
|||||||
public function getTransactionJournalsInRepetition(\Budget $budget, \LimitRepetition $repetition, $limit = 50)
|
public function getTransactionJournalsInRepetition(\Budget $budget, \LimitRepetition $repetition, $limit = 50)
|
||||||
{
|
{
|
||||||
$start = $repetition->startdate;
|
$start = $repetition->startdate;
|
||||||
$end = $repetition->enddate;
|
$end = $repetition->enddate;
|
||||||
|
|
||||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||||
$set = $budget->transactionJournals()->withRelevantData()->before($end)->after($start)->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
$set = $budget->transactionJournals()->withRelevantData()->before($end)->after($start)->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(
|
||||||
|
['transaction_journals.*']
|
||||||
|
);
|
||||||
$count = $budget->transactionJournals()->before($end)->after($start)->count();
|
$count = $budget->transactionJournals()->before($end)->after($start)->count();
|
||||||
$items = [];
|
$items = [];
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
|
@ -46,15 +46,16 @@ class Category implements CUD, CommonDatabaseCalls, CategoryInterface
|
|||||||
*/
|
*/
|
||||||
public function store(array $data)
|
public function store(array $data)
|
||||||
{
|
{
|
||||||
$category = new \Category;
|
$category = new \Category;
|
||||||
$category->name = $data['name'];
|
$category->name = $data['name'];
|
||||||
$category->class = 'Category';
|
$category->class = 'Category';
|
||||||
$category->user()->associate($this->getUser());
|
$category->user()->associate($this->getUser());
|
||||||
if(!$category->validate()) {
|
if (!$category->validate()) {
|
||||||
var_dump($category->errors());
|
var_dump($category->errors());
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
$category->save();
|
$category->save();
|
||||||
|
|
||||||
return $category;
|
return $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,14 @@ interface RecurringInterface
|
|||||||
*/
|
*/
|
||||||
public function getJournalForRecurringInRange(\RecurringTransaction $recurring, Carbon $start, Carbon $end);
|
public function getJournalForRecurringInRange(\RecurringTransaction $recurring, Carbon $start, Carbon $end);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \RecurringTransaction $recurring
|
||||||
|
* @param \TransactionJournal $journal
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function scan(\RecurringTransaction $recurring, \TransactionJournal $journal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \RecurringTransaction $recurring
|
* @param \RecurringTransaction $recurring
|
||||||
*
|
*
|
||||||
@ -27,12 +35,4 @@ interface RecurringInterface
|
|||||||
*/
|
*/
|
||||||
public function scanEverything(\RecurringTransaction $recurring);
|
public function scanEverything(\RecurringTransaction $recurring);
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \RecurringTransaction $recurring
|
|
||||||
* @param \TransactionJournal $journal
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function scan(\RecurringTransaction $recurring,\TransactionJournal $journal);
|
|
||||||
|
|
||||||
}
|
}
|
@ -59,6 +59,7 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$piggybank->save();
|
$piggybank->save();
|
||||||
|
|
||||||
return $piggybank;
|
return $piggybank;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,9 +198,8 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
|||||||
public function find($id)
|
public function find($id)
|
||||||
{
|
{
|
||||||
return \Piggybank::
|
return \Piggybank::
|
||||||
leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')
|
leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')->where('piggybanks.id', '=', $id)->where('accounts.user_id', $this->getUser()->id)
|
||||||
->where('piggybanks.id','=',$id)
|
->first(['piggybanks.*']);
|
||||||
->where('accounts.user_id', $this->getUser()->id)->first(['piggybanks.*']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,6 +38,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
|||||||
public function destroy(Ardent $model)
|
public function destroy(Ardent $model)
|
||||||
{
|
{
|
||||||
$model->delete();
|
$model->delete();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,19 +129,19 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
|||||||
/*
|
/*
|
||||||
* Store the budget.
|
* Store the budget.
|
||||||
*/
|
*/
|
||||||
if(isset($data['budget_id']) && intval($data['budget_id']) > 0) {
|
if (isset($data['budget_id']) && intval($data['budget_id']) > 0) {
|
||||||
/** @var \FireflyIII\Database\Budget $budgetRepository */
|
/** @var \FireflyIII\Database\Budget $budgetRepository */
|
||||||
$budgetRepository = \App::make('FireflyIII\Database\Budget');
|
$budgetRepository = \App::make('FireflyIII\Database\Budget');
|
||||||
$budget = $budgetRepository->find(intval($data['budget_id']));
|
$budget = $budgetRepository->find(intval($data['budget_id']));
|
||||||
if($budget) {
|
if ($budget) {
|
||||||
$journal->budgets()->save($budget);
|
$journal->budgets()->save($budget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(strlen($data['category']) > 0) {
|
if (strlen($data['category']) > 0) {
|
||||||
/** @var \FireflyIII\Database\Category $categoryRepository */
|
/** @var \FireflyIII\Database\Category $categoryRepository */
|
||||||
$categoryRepository = \App::make('FireflyIII\Database\Category');
|
$categoryRepository = \App::make('FireflyIII\Database\Category');
|
||||||
$category = $categoryRepository->firstOrCreate($data['category']);
|
$category = $categoryRepository->firstOrCreate($data['category']);
|
||||||
if($category) {
|
if ($category) {
|
||||||
$journal->categories()->save($category);
|
$journal->categories()->save($category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,19 +223,19 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
|||||||
/*
|
/*
|
||||||
* Store the budget.
|
* Store the budget.
|
||||||
*/
|
*/
|
||||||
if(isset($data['budget_id']) && intval($data['budget_id']) > 0) {
|
if (isset($data['budget_id']) && intval($data['budget_id']) > 0) {
|
||||||
/** @var \FireflyIII\Database\Budget $budgetRepository */
|
/** @var \FireflyIII\Database\Budget $budgetRepository */
|
||||||
$budgetRepository = \App::make('FireflyIII\Database\Budget');
|
$budgetRepository = \App::make('FireflyIII\Database\Budget');
|
||||||
$budget = $budgetRepository->find(intval($data['budget_id']));
|
$budget = $budgetRepository->find(intval($data['budget_id']));
|
||||||
if($budget) {
|
if ($budget) {
|
||||||
$model->budgets()->sync([$budget->id]);
|
$model->budgets()->sync([$budget->id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(strlen($data['category']) > 0) {
|
if (strlen($data['category']) > 0) {
|
||||||
/** @var \FireflyIII\Database\Category $categoryRepository */
|
/** @var \FireflyIII\Database\Category $categoryRepository */
|
||||||
$categoryRepository = \App::make('FireflyIII\Database\Category');
|
$categoryRepository = \App::make('FireflyIII\Database\Category');
|
||||||
$category = $categoryRepository->firstOrCreate($data['category']);
|
$category = $categoryRepository->firstOrCreate($data['category']);
|
||||||
if($category) {
|
if ($category) {
|
||||||
$model->categories()->sync([$category->id]);
|
$model->categories()->sync([$category->id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -545,6 +546,22 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
|||||||
return $sum;
|
return $sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDepositsPaginated($limit = 50)
|
||||||
|
{
|
||||||
|
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||||
|
|
||||||
|
$set = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->withRelevantData()->take($limit)->offset($offset)->orderBy(
|
||||||
|
'date', 'DESC'
|
||||||
|
)->get(['transaction_journals.*']);
|
||||||
|
$count = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->count();
|
||||||
|
$items = [];
|
||||||
|
foreach ($set as $entry) {
|
||||||
|
$items[] = $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return \Paginator::make($items, $count, $limit);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Account $account
|
* @param \Account $account
|
||||||
* @param int $count
|
* @param int $count
|
||||||
@ -568,12 +585,15 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWithdrawalsPaginated($limit = 50) {
|
public function getTransfersPaginated($limit = 50)
|
||||||
|
{
|
||||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||||
|
|
||||||
$set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
$set = $this->getUser()->transactionJournals()->transactionTypes(['Transfer'])->withRelevantData()->take($limit)->offset($offset)->orderBy(
|
||||||
$count = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->count();
|
'date', 'DESC'
|
||||||
$items = [];
|
)->get(['transaction_journals.*']);
|
||||||
|
$count = $this->getUser()->transactionJournals()->transactionTypes(['Transfer'])->count();
|
||||||
|
$items = [];
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$items[] = $entry;
|
$items[] = $entry;
|
||||||
}
|
}
|
||||||
@ -581,25 +601,15 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
|||||||
return \Paginator::make($items, $count, $limit);
|
return \Paginator::make($items, $count, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDepositsPaginated($limit = 50) {
|
public function getWithdrawalsPaginated($limit = 50)
|
||||||
|
{
|
||||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||||
|
|
||||||
$set = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
$set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->take($limit)->offset($offset)->orderBy(
|
||||||
$count = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->count();
|
'date', 'DESC'
|
||||||
$items = [];
|
)->get(['transaction_journals.*']);
|
||||||
foreach ($set as $entry) {
|
$count = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->count();
|
||||||
$items[] = $entry;
|
$items = [];
|
||||||
}
|
|
||||||
|
|
||||||
return \Paginator::make($items, $count, $limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTransfersPaginated($limit = 50) {
|
|
||||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
|
||||||
|
|
||||||
$set = $this->getUser()->transactionJournals()->transactionTypes(['Transfer'])->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
|
||||||
$count = $this->getUser()->transactionJournals()->transactionTypes(['Transfer'])->count();
|
|
||||||
$items = [];
|
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$items[] = $entry;
|
$items[] = $entry;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,18 @@ class Piggybank
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public function storePiggybank(\Piggybank $piggybank)
|
||||||
|
{
|
||||||
|
if (intval($piggybank->repeats) == 0) {
|
||||||
|
$repetition = new \PiggybankRepetition;
|
||||||
|
$repetition->piggybank()->associate($piggybank);
|
||||||
|
$repetition->startdate = $piggybank->startdate;
|
||||||
|
$repetition->targetdate = $piggybank->targetdate;
|
||||||
|
$repetition->currentamount = 0;
|
||||||
|
$repetition->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \TransactionJournal $journal
|
* @param \TransactionJournal $journal
|
||||||
* @param int $piggybankId
|
* @param int $piggybankId
|
||||||
@ -159,17 +171,6 @@ class Piggybank
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storePiggybank(\Piggybank $piggybank) {
|
|
||||||
if(intval($piggybank->repeats) == 0) {
|
|
||||||
$repetition = new \PiggybankRepetition;
|
|
||||||
$repetition->piggybank()->associate($piggybank);
|
|
||||||
$repetition->startdate = $piggybank->startdate;
|
|
||||||
$repetition->targetdate = $piggybank->targetdate;
|
|
||||||
$repetition->currentamount = 0;
|
|
||||||
$repetition->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Dispatcher $events
|
* @param Dispatcher $events
|
||||||
*/
|
*/
|
||||||
|
@ -31,67 +31,6 @@ class Form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $name
|
|
||||||
* @param null $value
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
public static function ffBalance($name, $value = null, array $options = [])
|
|
||||||
{
|
|
||||||
$options['step'] = 'any';
|
|
||||||
|
|
||||||
return self::ffInput('amount', $name, $value, $options);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $name
|
|
||||||
* @param int $value
|
|
||||||
* @param null $checked
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
public static function ffCheckbox($name, $value = 1, $checked = null, $options = [])
|
|
||||||
{
|
|
||||||
$options['checked'] = $checked ? true : null;
|
|
||||||
|
|
||||||
return self::ffInput('checkbox', $name, $value, $options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $name
|
|
||||||
* @param null $value
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
public static function ffDate($name, $value = null, array $options = [])
|
|
||||||
{
|
|
||||||
return self::ffInput('date', $name, $value, $options);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $name
|
|
||||||
* @param null $value
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
public static function ffInteger($name, $value = null, array $options = [])
|
|
||||||
{
|
|
||||||
$options['step'] = '1';
|
|
||||||
|
|
||||||
return self::ffInput('number', $name, $value, $options);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $type
|
* @param $type
|
||||||
* @param $name
|
* @param $name
|
||||||
@ -113,7 +52,6 @@ class Form
|
|||||||
$label = self::label($name, $options);
|
$label = self::label($name, $options);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make label and placeholder look nice.
|
* Make label and placeholder look nice.
|
||||||
*/
|
*/
|
||||||
@ -272,6 +210,67 @@ class Form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @param null $value
|
||||||
|
* @param array $options
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public static function ffBalance($name, $value = null, array $options = [])
|
||||||
|
{
|
||||||
|
$options['step'] = 'any';
|
||||||
|
|
||||||
|
return self::ffInput('amount', $name, $value, $options);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @param int $value
|
||||||
|
* @param null $checked
|
||||||
|
* @param array $options
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public static function ffCheckbox($name, $value = 1, $checked = null, $options = [])
|
||||||
|
{
|
||||||
|
$options['checked'] = $checked ? true : null;
|
||||||
|
|
||||||
|
return self::ffInput('checkbox', $name, $value, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @param null $value
|
||||||
|
* @param array $options
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public static function ffDate($name, $value = null, array $options = [])
|
||||||
|
{
|
||||||
|
return self::ffInput('date', $name, $value, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @param null $value
|
||||||
|
* @param array $options
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @throws FireflyException
|
||||||
|
*/
|
||||||
|
public static function ffInteger($name, $value = null, array $options = [])
|
||||||
|
{
|
||||||
|
$options['step'] = '1';
|
||||||
|
|
||||||
|
return self::ffInput('number', $name, $value, $options);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return buttons for update/validate/return.
|
* Return buttons for update/validate/return.
|
||||||
*
|
*
|
||||||
|
@ -85,6 +85,7 @@ class Date
|
|||||||
$currentEnd->addYear()->subDay();
|
$currentEnd->addYear()->subDay();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $currentEnd;
|
return $currentEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,28 +3,29 @@ use Carbon\Carbon;
|
|||||||
use LaravelBook\Ardent\Ardent as Ardent;
|
use LaravelBook\Ardent\Ardent as Ardent;
|
||||||
use LaravelBook\Ardent\Builder;
|
use LaravelBook\Ardent\Builder;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account
|
* Account
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property integer $account_type_id
|
* @property integer $account_type_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property boolean $active
|
* @property boolean $active
|
||||||
* @property-read \AccountType $accountType
|
* @property-read \AccountType $accountType
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Piggybank[] $piggybanks
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Piggybank[] $piggybanks
|
||||||
* @property-read \User $user
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Account whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Account whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Account whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Account whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Account whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Account whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Account whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Account whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Account whereAccountTypeId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Account whereAccountTypeId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Account whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\Account whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Account whereActive($value)
|
* @method static \Illuminate\Database\Query\Builder|\Account whereActive($value)
|
||||||
* @method static \Account accountTypeIn($types)
|
* @method static \Account accountTypeIn($types)
|
||||||
*/
|
*/
|
||||||
class Account extends Ardent
|
class Account extends Ardent
|
||||||
{
|
{
|
||||||
@ -70,6 +71,16 @@ class Account extends Ardent
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transactions.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
*/
|
||||||
|
public function transactions()
|
||||||
|
{
|
||||||
|
return $this->hasMany('Transaction');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
@ -92,23 +103,13 @@ class Account extends Ardent
|
|||||||
public function lastActionDate()
|
public function lastActionDate()
|
||||||
{
|
{
|
||||||
$transaction = $this->transactions()->orderBy('updated_at', 'DESC')->first();
|
$transaction = $this->transactions()->orderBy('updated_at', 'DESC')->first();
|
||||||
if(is_null($transaction)) {
|
if (is_null($transaction)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $transaction->updated_at;
|
return $transaction->updated_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Transactions.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
||||||
*/
|
|
||||||
public function transactions()
|
|
||||||
{
|
|
||||||
return $this->hasMany('Transaction');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
use LaravelBook\Ardent\Ardent as Ardent;
|
use LaravelBook\Ardent\Ardent as Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountMeta
|
* AccountMeta
|
||||||
*
|
*
|
||||||
|
@ -2,20 +2,21 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountType
|
* AccountType
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $type
|
* @property string $type
|
||||||
* @property boolean $editable
|
* @property boolean $editable
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
|
||||||
* @method static \Illuminate\Database\Query\Builder|\AccountType whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\AccountType whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\AccountType whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\AccountType whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\AccountType whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\AccountType whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\AccountType whereType($value)
|
* @method static \Illuminate\Database\Query\Builder|\AccountType whereType($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\AccountType whereEditable($value)
|
* @method static \Illuminate\Database\Query\Builder|\AccountType whereEditable($value)
|
||||||
*/
|
*/
|
||||||
class AccountType extends Eloquent
|
class AccountType extends Eloquent
|
||||||
{
|
{
|
||||||
|
@ -3,22 +3,22 @@
|
|||||||
/**
|
/**
|
||||||
* Budget
|
* Budget
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property string $class
|
* @property string $class
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
||||||
* @property-read \User $user
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Budget whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Budget whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Budget whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Budget whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Budget whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Budget whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Budget whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\Budget whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Budget whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Budget whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Budget whereClass($value)
|
* @method static \Illuminate\Database\Query\Builder|\Budget whereClass($value)
|
||||||
*/
|
*/
|
||||||
class Budget extends Component
|
class Budget extends Component
|
||||||
{
|
{
|
||||||
|
@ -1,29 +1,43 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category
|
* Category
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property string $class
|
* @property string $class
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
||||||
* @property-read \User $user
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Category whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Category whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Category whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Category whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Category whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Category whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Category whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\Category whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Category whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Category whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Category whereClass($value)
|
* @method static \Illuminate\Database\Query\Builder|\Category whereClass($value)
|
||||||
*/
|
*/
|
||||||
class Category extends Component
|
class Category extends Component
|
||||||
{
|
{
|
||||||
protected $isSubclass = true;
|
protected $isSubclass = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Carbon
|
||||||
|
*/
|
||||||
|
public function lastActionDate()
|
||||||
|
{
|
||||||
|
$transaction = $this->transactionjournals()->orderBy('updated_at', 'DESC')->first();
|
||||||
|
if (is_null($transaction)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $transaction->date;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
*/
|
*/
|
||||||
@ -31,16 +45,4 @@ class Category extends Component
|
|||||||
{
|
{
|
||||||
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
|
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @return Carbon
|
|
||||||
*/
|
|
||||||
public function lastActionDate()
|
|
||||||
{
|
|
||||||
$transaction = $this->transactionjournals()->orderBy('updated_at', 'DESC')->first();
|
|
||||||
if(is_null($transaction)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $transaction->date;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,25 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
use FireflyIII\Shared\SingleTableInheritanceEntity;
|
use FireflyIII\Shared\SingleTableInheritanceEntity;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component
|
* Component
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property string $class
|
* @property string $class
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
||||||
* @property-read \User $user
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Component whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Component whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Component whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Component whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Component whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Component whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Component whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\Component whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Component whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Component whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Component whereClass($value)
|
* @method static \Illuminate\Database\Query\Builder|\Component whereClass($value)
|
||||||
*/
|
*/
|
||||||
class Component extends SingleTableInheritanceEntity
|
class Component extends SingleTableInheritanceEntity
|
||||||
{
|
{
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Importentry
|
* Importentry
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $class
|
* @property string $class
|
||||||
* @property integer $importmap_id
|
* @property integer $importmap_id
|
||||||
* @property integer $old
|
* @property integer $old
|
||||||
* @property integer $new
|
* @property integer $new
|
||||||
* @property-read \Importmap $importmap
|
* @property-read \Importmap $importmap
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importentry whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importentry whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importentry whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importentry whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importentry whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importentry whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importentry whereClass($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importentry whereClass($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importentry whereImportmapId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importentry whereImportmapId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importentry whereOld($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importentry whereOld($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importentry whereNew($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importentry whereNew($value)
|
||||||
*/
|
*/
|
||||||
class Importentry extends Eloquent
|
class Importentry extends Eloquent
|
||||||
{
|
{
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
use LaravelBook\Ardent\Ardent as Ardent;
|
use LaravelBook\Ardent\Ardent as Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Importmap
|
* Importmap
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property string $file
|
* @property string $file
|
||||||
* @property integer $totaljobs
|
* @property integer $totaljobs
|
||||||
* @property integer $jobsdone
|
* @property integer $jobsdone
|
||||||
* @property-read \User $user
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importmap whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importmap whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importmap whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importmap whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereFile($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importmap whereFile($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereTotaljobs($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importmap whereTotaljobs($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Importmap whereJobsdone($value)
|
* @method static \Illuminate\Database\Query\Builder|\Importmap whereJobsdone($value)
|
||||||
*/
|
*/
|
||||||
class Importmap extends Ardent
|
class Importmap extends Ardent
|
||||||
{
|
{
|
||||||
|
@ -4,28 +4,29 @@ use Carbon\Carbon;
|
|||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use LaravelBook\Ardent\Ardent as Ardent;
|
use LaravelBook\Ardent\Ardent as Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limit
|
* Limit
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $component_id
|
* @property integer $component_id
|
||||||
* @property \Carbon\Carbon $startdate
|
* @property \Carbon\Carbon $startdate
|
||||||
* @property float $amount
|
* @property float $amount
|
||||||
* @property boolean $repeats
|
* @property boolean $repeats
|
||||||
* @property string $repeat_freq
|
* @property string $repeat_freq
|
||||||
* @property-read \Budget $budget
|
* @property-read \Budget $budget
|
||||||
* @property-read \Component $component
|
* @property-read \Component $component
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\LimitRepetition[] $limitrepetitions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\LimitRepetition[] $limitrepetitions
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Limit whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Limit whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Limit whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereComponentId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Limit whereComponentId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereStartdate($value)
|
* @method static \Illuminate\Database\Query\Builder|\Limit whereStartdate($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereAmount($value)
|
* @method static \Illuminate\Database\Query\Builder|\Limit whereAmount($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeats($value)
|
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeats($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeatFreq($value)
|
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeatFreq($value)
|
||||||
*/
|
*/
|
||||||
class Limit extends Ardent
|
class Limit extends Ardent
|
||||||
{
|
{
|
||||||
|
@ -3,24 +3,25 @@
|
|||||||
use FireflyIII\Exception\FireflyException;
|
use FireflyIII\Exception\FireflyException;
|
||||||
use LaravelBook\Ardent\Ardent as Ardent;
|
use LaravelBook\Ardent\Ardent as Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LimitRepetition
|
* LimitRepetition
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $limit_id
|
* @property integer $limit_id
|
||||||
* @property \Carbon\Carbon $startdate
|
* @property \Carbon\Carbon $startdate
|
||||||
* @property \Carbon\Carbon $enddate
|
* @property \Carbon\Carbon $enddate
|
||||||
* @property float $amount
|
* @property float $amount
|
||||||
* @property-read \Limit $limit
|
* @property-read \Limit $limit
|
||||||
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereLimitId($value)
|
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereLimitId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereStartdate($value)
|
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereStartdate($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereEnddate($value)
|
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereEnddate($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereAmount($value)
|
* @method static \Illuminate\Database\Query\Builder|\LimitRepetition whereAmount($value)
|
||||||
*/
|
*/
|
||||||
class LimitRepetition extends Ardent
|
class LimitRepetition extends Ardent
|
||||||
{
|
{
|
||||||
@ -47,14 +48,14 @@ class LimitRepetition extends Ardent
|
|||||||
public function spentInRepetition()
|
public function spentInRepetition()
|
||||||
{
|
{
|
||||||
$sum = \DB::table('transactions')->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')->leftJoin(
|
$sum = \DB::table('transactions')->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')->leftJoin(
|
||||||
'component_transaction_journal', 'component_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
|
'component_transaction_journal', 'component_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
|
||||||
)->leftJoin('components', 'components.id', '=', 'component_transaction_journal.component_id')->leftJoin(
|
)->leftJoin('components', 'components.id', '=', 'component_transaction_journal.component_id')->leftJoin(
|
||||||
'limits', 'limits.component_id', '=', 'components.id'
|
'limits', 'limits.component_id', '=', 'components.id'
|
||||||
)->leftJoin('limit_repetitions', 'limit_repetitions.limit_id', '=', 'limits.id')->where(
|
)->leftJoin('limit_repetitions', 'limit_repetitions.limit_id', '=', 'limits.id')->where(
|
||||||
'transaction_journals.date', '>=', $this->startdate->format('Y-m-d')
|
'transaction_journals.date', '>=', $this->startdate->format('Y-m-d')
|
||||||
)->where('transaction_journals.date', '<=', $this->enddate->format('Y-m-d'))->where('transactions.amount', '>', 0)->where(
|
)->where('transaction_journals.date', '<=', $this->enddate->format('Y-m-d'))->where('transactions.amount', '>', 0)->where(
|
||||||
'limit_repetitions.id', '=', $this->id
|
'limit_repetitions.id', '=', $this->id
|
||||||
)->sum('transactions.amount');
|
)->sum('transactions.amount');
|
||||||
|
|
||||||
return floatval($sum);
|
return floatval($sum);
|
||||||
}
|
}
|
||||||
|
@ -2,45 +2,46 @@
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use LaravelBook\Ardent\Ardent as Ardent;
|
use LaravelBook\Ardent\Ardent as Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Piggybank
|
* Piggybank
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $account_id
|
* @property integer $account_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property float $targetamount
|
* @property float $targetamount
|
||||||
* @property \Carbon\Carbon $startdate
|
* @property \Carbon\Carbon $startdate
|
||||||
* @property \Carbon\Carbon $targetdate
|
* @property \Carbon\Carbon $targetdate
|
||||||
* @property boolean $repeats
|
* @property boolean $repeats
|
||||||
* @property string $rep_length
|
* @property string $rep_length
|
||||||
* @property integer $rep_every
|
* @property integer $rep_every
|
||||||
* @property integer $rep_times
|
* @property integer $rep_times
|
||||||
* @property string $reminder
|
* @property string $reminder
|
||||||
* @property integer $reminder_skip
|
* @property integer $reminder_skip
|
||||||
* @property boolean $remind_me
|
* @property integer $order
|
||||||
* @property integer $order
|
* @property boolean $remind_me
|
||||||
* @property-read \Account $account
|
* @property-read \Account $account
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankRepetition[] $piggybankrepetitions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankRepetition[] $piggybankrepetitions
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankEvent[] $piggybankevents
|
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankEvent[] $piggybankevents
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereAccountId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereAccountId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereTargetamount($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereTargetamount($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereStartdate($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereStartdate($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereTargetdate($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereTargetdate($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRepeats($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRepeats($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRepLength($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRepLength($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRepEvery($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRepEvery($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRepTimes($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRepTimes($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereReminder($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereReminder($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereReminderSkip($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereReminderSkip($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRemindMe($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereOrder($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereOrder($value)
|
* @method static \Illuminate\Database\Query\Builder|\Piggybank whereRemindMe($value)
|
||||||
*/
|
*/
|
||||||
class Piggybank extends Ardent
|
class Piggybank extends Ardent
|
||||||
{
|
{
|
||||||
@ -70,21 +71,23 @@ class Piggybank extends Ardent
|
|||||||
return $this->belongsTo('Account');
|
return $this->belongsTo('Account');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countFutureReminders() {
|
public function countFutureReminders()
|
||||||
|
{
|
||||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||||
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
||||||
|
|
||||||
if(is_null($this->reminder)) {
|
if (is_null($this->reminder)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$start = new Carbon;
|
$start = new Carbon;
|
||||||
$end = !is_null($this->targetdate) ? clone $this->targetdate : new Carbon;
|
$end = !is_null($this->targetdate) ? clone $this->targetdate : new Carbon;
|
||||||
$reminders = 0;
|
$reminders = 0;
|
||||||
while($start <= $end) {
|
while ($start <= $end) {
|
||||||
$reminders++;
|
$reminders++;
|
||||||
$start = $dateKit->addPeriod($start, $this->reminder, $this->reminder_skip);
|
$start = $dateKit->addPeriod($start, $this->reminder, $this->reminder_skip);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $reminders;
|
return $reminders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,22 +2,26 @@
|
|||||||
|
|
||||||
use LaravelBook\Ardent\Ardent as Ardent;
|
use LaravelBook\Ardent\Ardent as Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PiggybankEvent
|
* PiggybankEvent
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $piggybank_id
|
* @property integer $piggybank_id
|
||||||
* @property \Carbon\Carbon $date
|
* @property \Carbon\Carbon $date
|
||||||
* @property float $amount
|
* @property float $amount
|
||||||
|
* @property integer $transaction_journal_id
|
||||||
* @property-read \Piggybank $piggybank
|
* @property-read \Piggybank $piggybank
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereId($value)
|
* @property-read \TransactionJournal $transactionJournal
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent wherePiggybankId($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereDate($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent wherePiggybankId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereAmount($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereDate($value)
|
||||||
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereAmount($value)
|
||||||
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereTransactionJournalId($value)
|
||||||
*/
|
*/
|
||||||
class PiggybankEvent extends Ardent
|
class PiggybankEvent extends Ardent
|
||||||
{
|
{
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
use LaravelBook\Ardent\Ardent as Ardent;
|
use LaravelBook\Ardent\Ardent as Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PiggybankRepetition
|
* PiggybankRepetition
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $piggybank_id
|
* @property integer $piggybank_id
|
||||||
* @property \Carbon\Carbon $startdate
|
* @property \Carbon\Carbon $startdate
|
||||||
* @property \Carbon\Carbon $targetdate
|
* @property \Carbon\Carbon $targetdate
|
||||||
* @property float $currentamount
|
* @property float $currentamount
|
||||||
* @property-read \Piggybank $piggybank
|
* @property-read \Piggybank $piggybank
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition wherePiggybankId($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition wherePiggybankId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereStartdate($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereStartdate($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereTargetdate($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereTargetdate($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereCurrentamount($value)
|
* @method static \Illuminate\Database\Query\Builder|\PiggybankRepetition whereCurrentamount($value)
|
||||||
*/
|
*/
|
||||||
class PiggybankRepetition extends Ardent
|
class PiggybankRepetition extends Ardent
|
||||||
{
|
{
|
||||||
|
@ -2,22 +2,23 @@
|
|||||||
|
|
||||||
use LaravelBook\Ardent\Ardent;
|
use LaravelBook\Ardent\Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preference
|
* Preference
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $data
|
* @property string $data
|
||||||
* @property-read \User $user
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Preference whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Preference whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Preference whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Preference whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\Preference whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereData($value)
|
* @method static \Illuminate\Database\Query\Builder|\Preference whereData($value)
|
||||||
*/
|
*/
|
||||||
class Preference extends Ardent
|
class Preference extends Ardent
|
||||||
{
|
{
|
||||||
|
@ -2,36 +2,38 @@
|
|||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use LaravelBook\Ardent\Ardent;
|
use LaravelBook\Ardent\Ardent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RecurringTransaction
|
* RecurringTransaction
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $match
|
* @property string $match
|
||||||
* @property float $amount_max
|
* @property float $amount_min
|
||||||
* @property float $amount_min
|
* @property float $amount_max
|
||||||
* @property \Carbon\Carbon $date
|
* @property \Carbon\Carbon $date
|
||||||
* @property boolean $active
|
* @property boolean $active
|
||||||
* @property boolean $automatch
|
* @property boolean $automatch
|
||||||
* @property string $repeat_freq
|
* @property string $repeat_freq
|
||||||
* @property integer $skip
|
* @property integer $skip
|
||||||
* @property-read \User $user
|
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereId($value)
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereName($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereMatch($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAmountMax($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereMatch($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAmountMin($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAmountMin($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereDate($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAmountMax($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereActive($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereDate($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAutomatch($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereActive($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereRepeatFreq($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAutomatch($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereSkip($value)
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereRepeatFreq($value)
|
||||||
|
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereSkip($value)
|
||||||
*/
|
*/
|
||||||
class RecurringTransaction extends Ardent
|
class RecurringTransaction extends Ardent
|
||||||
{
|
{
|
||||||
@ -51,14 +53,24 @@ class RecurringTransaction extends Ardent
|
|||||||
return ['created_at', 'updated_at', 'date'];
|
return ['created_at', 'updated_at', 'date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lastFoundMatch() {
|
public function lastFoundMatch()
|
||||||
$last = $this->transactionjournals()->orderBy('date','DESC')->first();
|
{
|
||||||
if($last) {
|
$last = $this->transactionjournals()->orderBy('date', 'DESC')->first();
|
||||||
|
if ($last) {
|
||||||
return $last->date;
|
return $last->date;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
*/
|
||||||
|
public function transactionjournals()
|
||||||
|
{
|
||||||
|
return $this->hasMany('TransactionJournal');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the next expected match based on the set journals and the date stuff from the recurring
|
* Find the next expected match based on the set journals and the date stuff from the recurring
|
||||||
* transaction.
|
* transaction.
|
||||||
@ -110,15 +122,8 @@ class RecurringTransaction extends Ardent
|
|||||||
$start = $dateKit->addPeriod($start, $this->repeat_freq, 0);
|
$start = $dateKit->addPeriod($start, $this->repeat_freq, 0);
|
||||||
$counter++;
|
$counter++;
|
||||||
}
|
}
|
||||||
return $finalDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return $finalDate;
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
||||||
*/
|
|
||||||
public function transactionjournals()
|
|
||||||
{
|
|
||||||
return $this->hasMany('TransactionJournal');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,21 +6,25 @@ use LaravelBook\Ardent\Ardent;
|
|||||||
/**
|
/**
|
||||||
* Reminder
|
* Reminder
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property \Carbon\Carbon $startdate
|
* @property \Carbon\Carbon $startdate
|
||||||
* @property \Carbon\Carbon $enddate
|
* @property \Carbon\Carbon $enddate
|
||||||
* @property boolean $active
|
* @property boolean $active
|
||||||
* @property-read \User $user
|
* @property string $title
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereId($value)
|
* @property string $data
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereCreatedAt($value)
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereStartdate($value)
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereEnddate($value)
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereActive($value)
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereStartdate($value)
|
||||||
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereEnddate($value)
|
||||||
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereActive($value)
|
||||||
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereTitle($value)
|
||||||
|
* @method static \Illuminate\Database\Query\Builder|\Reminder whereData($value)
|
||||||
*/
|
*/
|
||||||
class Reminder extends Ardent
|
class Reminder extends Ardent
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exception\NotImplementedException;
|
|
||||||
use LaravelBook\Ardent\Ardent;
|
use LaravelBook\Ardent\Ardent;
|
||||||
use LaravelBook\Ardent\Builder;
|
use LaravelBook\Ardent\Builder;
|
||||||
|
|
||||||
@ -9,34 +8,34 @@ use LaravelBook\Ardent\Builder;
|
|||||||
/**
|
/**
|
||||||
* Transaction
|
* Transaction
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $account_id
|
* @property integer $account_id
|
||||||
* @property integer $piggybank_id
|
* @property integer $piggybank_id
|
||||||
* @property integer $transaction_journal_id
|
* @property integer $transaction_journal_id
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property float $amount
|
* @property float $amount
|
||||||
* @property-read \Account $account
|
* @property-read \Account $account
|
||||||
* @property-read \Piggybank $piggybank
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
||||||
* @property-read \TransactionJournal $transactionJournal
|
* @property-read \Piggybank $piggybank
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereId($value)
|
* @property-read \TransactionJournal $transactionJournal
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Transaction whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\Transaction whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereAccountId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Transaction whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Transaction wherePiggybankId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Transaction whereAccountId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereTransactionJournalId($value)
|
* @method static \Illuminate\Database\Query\Builder|\Transaction wherePiggybankId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereDescription($value)
|
* @method static \Illuminate\Database\Query\Builder|\Transaction whereTransactionJournalId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereAmount($value)
|
* @method static \Illuminate\Database\Query\Builder|\Transaction whereDescription($value)
|
||||||
* @method static \Transaction accountIs($account)
|
* @method static \Illuminate\Database\Query\Builder|\Transaction whereAmount($value)
|
||||||
* @method static \Transaction after($date)
|
* @method static \Transaction accountIs($account)
|
||||||
* @method static \Transaction before($date)
|
* @method static \Transaction after($date)
|
||||||
* @method static \Transaction lessThan($amount)
|
* @method static \Transaction before($date)
|
||||||
* @method static \Transaction moreThan($amount)
|
* @method static \Transaction lessThan($amount)
|
||||||
* @method static \Transaction transactionTypes($types)
|
* @method static \Transaction moreThan($amount)
|
||||||
|
* @method static \Transaction transactionTypes($types)
|
||||||
*/
|
*/
|
||||||
class Transaction extends Ardent
|
class Transaction extends Ardent
|
||||||
{
|
{
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransactionCurrency
|
* TransactionCurrency
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $code
|
* @property string $code
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereCode($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionCurrency whereCode($value)
|
||||||
*/
|
*/
|
||||||
class TransactionCurrency extends Eloquent
|
class TransactionCurrency extends Eloquent
|
||||||
{
|
{
|
||||||
|
@ -4,48 +4,50 @@ use Carbon\Carbon;
|
|||||||
use LaravelBook\Ardent\Ardent;
|
use LaravelBook\Ardent\Ardent;
|
||||||
use LaravelBook\Ardent\Builder;
|
use LaravelBook\Ardent\Builder;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransactionJournal
|
* TransactionJournal
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property integer $user_id
|
* @property integer $user_id
|
||||||
* @property integer $transaction_type_id
|
* @property integer $transaction_type_id
|
||||||
* @property integer $recurring_transaction_id
|
* @property integer $recurring_transaction_id
|
||||||
* @property integer $transaction_currency_id
|
* @property integer $transaction_currency_id
|
||||||
* @property string $description
|
* @property string $description
|
||||||
* @property boolean $completed
|
* @property boolean $completed
|
||||||
* @property \Carbon\Carbon $date
|
* @property \Carbon\Carbon $date
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
||||||
* 'Budget[] $budgets
|
* 'Budget[] $budgets
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
||||||
* 'Category[] $categories
|
* 'Category[] $categories
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
||||||
* @property-read \RecurringTransaction $recurringTransaction
|
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankEvent[] $piggybankevents
|
||||||
* @property-read \TransactionCurrency $transactionCurrency
|
* @property-read \RecurringTransaction $recurringTransaction
|
||||||
* @property-read \TransactionType $transactionType
|
* @property-read \TransactionCurrency $transactionCurrency
|
||||||
|
* @property-read \TransactionType $transactionType
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
|
||||||
* @property-read \User $user
|
* @property-read \User $user
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereUserId($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereUserId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereTransactionTypeId($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereTransactionTypeId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereRecurringTransactionId($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereRecurringTransactionId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereTransactionCurrencyId($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereTransactionCurrencyId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDescription($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDescription($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereCompleted($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereCompleted($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDate($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionJournal whereDate($value)
|
||||||
* @method static \TransactionJournal accountIs($account)
|
* @method static \TransactionJournal accountIs($account)
|
||||||
* @method static \TransactionJournal after($date)
|
* @method static \TransactionJournal after($date)
|
||||||
* @method static \TransactionJournal before($date)
|
* @method static \TransactionJournal before($date)
|
||||||
* @method static \TransactionJournal defaultSorting()
|
* @method static \TransactionJournal defaultSorting()
|
||||||
* @method static \TransactionJournal moreThan($amount)
|
* @method static \TransactionJournal lessThan($amount)
|
||||||
* @method static \TransactionJournal lessThan($amount)
|
* @method static \TransactionJournal moreThan($amount)
|
||||||
* @method static \TransactionJournal onDate($date)
|
* @method static \TransactionJournal onDate($date)
|
||||||
* @method static \TransactionJournal transactionTypes($types)
|
* @method static \TransactionJournal transactionTypes($types)
|
||||||
* @method static \TransactionJournal withRelevantData()
|
* @method static \TransactionJournal withRelevantData()
|
||||||
*/
|
*/
|
||||||
class TransactionJournal extends Ardent
|
class TransactionJournal extends Ardent
|
||||||
{
|
{
|
||||||
@ -106,6 +108,14 @@ class TransactionJournal extends Ardent
|
|||||||
return ['created_at', 'updated_at', 'date'];
|
return ['created_at', 'updated_at', 'date'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
*/
|
||||||
|
public function piggybankevents()
|
||||||
|
{
|
||||||
|
return $this->hasMany('PiggybankEvent');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
*/
|
*/
|
||||||
@ -138,14 +148,6 @@ class TransactionJournal extends Ardent
|
|||||||
return $query->where('date', '>=', $date->format('Y-m-d'));
|
return $query->where('date', '>=', $date->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
||||||
*/
|
|
||||||
public function piggybankevents()
|
|
||||||
{
|
|
||||||
return $this->hasMany('PiggybankEvent');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $query
|
* @param $query
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
@ -221,7 +223,7 @@ class TransactionJournal extends Ardent
|
|||||||
$q->orderBy('amount', 'ASC');
|
$q->orderBy('amount', 'ASC');
|
||||||
}, 'transactiontype', 'components' => function ($q) {
|
}, 'transactiontype', 'components' => function ($q) {
|
||||||
$q->orderBy('class');
|
$q->orderBy('class');
|
||||||
}, 'transactions.account.accounttype', 'recurringTransaction','budgets','categories']
|
}, 'transactions.account.accounttype', 'recurringTransaction', 'budgets', 'categories']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,15 +5,15 @@ use LaravelBook\Ardent\Ardent;
|
|||||||
/**
|
/**
|
||||||
* TransactionType
|
* TransactionType
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $type
|
* @property string $type
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionJournals
|
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionJournals
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereType($value)
|
* @method static \Illuminate\Database\Query\Builder|\TransactionType whereType($value)
|
||||||
*/
|
*/
|
||||||
class TransactionType extends Ardent
|
class TransactionType extends Ardent
|
||||||
{
|
{
|
||||||
|
@ -9,29 +9,29 @@ use LaravelBook\Ardent\Ardent;
|
|||||||
/**
|
/**
|
||||||
* User
|
* User
|
||||||
*
|
*
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property \Carbon\Carbon $created_at
|
* @property \Carbon\Carbon $created_at
|
||||||
* @property \Carbon\Carbon $updated_at
|
* @property \Carbon\Carbon $updated_at
|
||||||
* @property string $email
|
* @property string $email
|
||||||
* @property string $password
|
* @property string $password
|
||||||
* @property string $reset
|
* @property string $reset
|
||||||
* @property string $remember_token
|
* @property string $remember_token
|
||||||
* @property boolean $migrated
|
* @property boolean $migrated
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Account[] $accounts
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Preference[] $preferences
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Preference[] $preferences
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\RecurringTransaction[] $recurringtransactions
|
* @property-read \Illuminate\Database\Eloquent\Collection|\RecurringTransaction[] $recurringtransactions
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
||||||
* @method static \Illuminate\Database\Query\Builder|\User whereId($value)
|
* @method static \Illuminate\Database\Query\Builder|\User whereId($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\User whereCreatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\User whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\User whereUpdatedAt($value)
|
* @method static \Illuminate\Database\Query\Builder|\User whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\User whereEmail($value)
|
* @method static \Illuminate\Database\Query\Builder|\User whereEmail($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\User wherePassword($value)
|
* @method static \Illuminate\Database\Query\Builder|\User wherePassword($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\User whereReset($value)
|
* @method static \Illuminate\Database\Query\Builder|\User whereReset($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\User whereRememberToken($value)
|
* @method static \Illuminate\Database\Query\Builder|\User whereRememberToken($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\User whereMigrated($value)
|
* @method static \Illuminate\Database\Query\Builder|\User whereMigrated($value)
|
||||||
*/
|
*/
|
||||||
class User extends Ardent implements UserInterface, RemindableInterface
|
class User extends Ardent implements UserInterface, RemindableInterface
|
||||||
{
|
{
|
||||||
|
@ -14,10 +14,7 @@
|
|||||||
ClassLoader::addDirectories(
|
ClassLoader::addDirectories(
|
||||||
[
|
[
|
||||||
|
|
||||||
app_path() . '/commands',
|
app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds',
|
||||||
app_path() . '/controllers',
|
|
||||||
app_path() . '/models',
|
|
||||||
app_path() . '/database/seeds',
|
|
||||||
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -54,4 +54,4 @@ return array(
|
|||||||
|
|
||||||
'storage' => __DIR__ . '/../app/storage',
|
'storage' => __DIR__ . '/../app/storage',
|
||||||
|
|
||||||
);
|
];
|
||||||
|
@ -38,10 +38,7 @@ $app = new Illuminate\Foundation\Application;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$env = $app->detectEnvironment(
|
$env = $app->detectEnvironment(
|
||||||
[
|
['local' => ['SMJD*'], 'homestead' => ['homestead']]
|
||||||
'local' => ['SMJD*'],
|
|
||||||
'homestead' => ['homestead']
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -69,8 +66,7 @@ $app->bindInstallPaths(require __DIR__ . '/paths.php');
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$framework = $app['path.base'] .
|
$framework = $app['path.base'] . '/vendor/laravel/framework/src';
|
||||||
'/vendor/laravel/framework/src';
|
|
||||||
|
|
||||||
require $framework . '/Illuminate/Foundation/start.php';
|
require $framework . '/Illuminate/Foundation/start.php';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user