mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup.
This commit is contained in:
parent
82c9a75578
commit
314abbea8b
@ -68,6 +68,7 @@ class CategoryController extends BaseController
|
||||
/** @var \FireflyIII\Database\Category $repos */
|
||||
$repos = App::make('FireflyIII\Database\Category');
|
||||
$categories = $repos->get();
|
||||
|
||||
return View::make('categories.index', compact('categories'));
|
||||
}
|
||||
|
||||
|
@ -481,10 +481,7 @@ class GoogleChartController extends BaseController
|
||||
$chart->addColumn('Balance', 'number');
|
||||
$sum = 0;
|
||||
|
||||
$set = \DB::table('piggybank_events')
|
||||
->where('piggybank_id',$piggybank->id)
|
||||
->groupBy('date')
|
||||
->get(['date',DB::Raw('SUM(`amount`) AS `sum`')]);
|
||||
$set = \DB::table('piggybank_events')->where('piggybank_id', $piggybank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]);
|
||||
|
||||
foreach ($set as $entry) {
|
||||
$chart->addRow(new Carbon($entry->date), floatval($entry->sum));
|
||||
|
@ -110,7 +110,8 @@ class PiggybankController extends BaseController
|
||||
* Flash some data to fill the form.
|
||||
*/
|
||||
$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);
|
||||
|
||||
return View::make('piggybanks.edit', compact('piggybank', 'accounts', 'periods', 'prefilled'))->with('title', 'Piggybanks')->with(
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
|
@ -201,7 +201,9 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
$end = $repetition->enddate;
|
||||
|
||||
$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();
|
||||
$items = [];
|
||||
foreach ($set as $entry) {
|
||||
|
@ -55,6 +55,7 @@ class Category implements CUD, CommonDatabaseCalls, CategoryInterface
|
||||
exit();
|
||||
}
|
||||
$category->save();
|
||||
|
||||
return $category;
|
||||
}
|
||||
|
||||
|
@ -20,13 +20,6 @@ interface RecurringInterface
|
||||
*/
|
||||
public function getJournalForRecurringInRange(\RecurringTransaction $recurring, Carbon $start, Carbon $end);
|
||||
|
||||
/**
|
||||
* @param \RecurringTransaction $recurring
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function scanEverything(\RecurringTransaction $recurring);
|
||||
|
||||
/**
|
||||
* @param \RecurringTransaction $recurring
|
||||
* @param \TransactionJournal $journal
|
||||
@ -35,4 +28,11 @@ interface RecurringInterface
|
||||
*/
|
||||
public function scan(\RecurringTransaction $recurring, \TransactionJournal $journal);
|
||||
|
||||
/**
|
||||
* @param \RecurringTransaction $recurring
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function scanEverything(\RecurringTransaction $recurring);
|
||||
|
||||
}
|
@ -59,6 +59,7 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
exit;
|
||||
}
|
||||
$piggybank->save();
|
||||
|
||||
return $piggybank;
|
||||
}
|
||||
|
||||
@ -197,9 +198,8 @@ class Piggybank implements CUD, CommonDatabaseCalls, PiggybankInterface
|
||||
public function find($id)
|
||||
{
|
||||
return \Piggybank::
|
||||
leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')
|
||||
->where('piggybanks.id','=',$id)
|
||||
->where('accounts.user_id', $this->getUser()->id)->first(['piggybanks.*']);
|
||||
leftJoin('accounts', 'accounts.id', '=', 'piggybanks.account_id')->where('piggybanks.id', '=', $id)->where('accounts.user_id', $this->getUser()->id)
|
||||
->first(['piggybanks.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
public function destroy(Ardent $model)
|
||||
{
|
||||
$model->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -545,6 +546,22 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
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 int $count
|
||||
@ -568,36 +585,13 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getWithdrawalsPaginated($limit = 50) {
|
||||
public function getTransfersPaginated($limit = 50)
|
||||
{
|
||||
$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.*']);
|
||||
$count = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->count();
|
||||
$items = [];
|
||||
foreach ($set as $entry) {
|
||||
$items[] = $entry;
|
||||
}
|
||||
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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.*']);
|
||||
$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) {
|
||||
@ -606,4 +600,20 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
}
|
||||
|
||||
public function getWithdrawalsPaginated($limit = 50)
|
||||
{
|
||||
$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.*']);
|
||||
$count = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->count();
|
||||
$items = [];
|
||||
foreach ($set as $entry) {
|
||||
$items[] = $entry;
|
||||
}
|
||||
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
}
|
||||
}
|
@ -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 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
|
||||
*/
|
||||
|
@ -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 $name
|
||||
@ -113,7 +52,6 @@ class Form
|
||||
$label = self::label($name, $options);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
|
@ -85,6 +85,7 @@ class Date
|
||||
$currentEnd->addYear()->subDay();
|
||||
break;
|
||||
}
|
||||
|
||||
return $currentEnd;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ use Carbon\Carbon;
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
use LaravelBook\Ardent\Builder;
|
||||
|
||||
|
||||
/**
|
||||
* Account
|
||||
*
|
||||
@ -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
|
||||
*
|
||||
@ -99,16 +110,6 @@ class Account extends Ardent
|
||||
return $transaction->updated_at;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transactions.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function transactions()
|
||||
{
|
||||
return $this->hasMany('Transaction');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* AccountMeta
|
||||
*
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
|
||||
/**
|
||||
* AccountType
|
||||
*
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Category
|
||||
*
|
||||
@ -24,13 +25,6 @@ class Category extends Component
|
||||
{
|
||||
protected $isSubclass = true;
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function transactionjournals()
|
||||
{
|
||||
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
|
||||
}
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
@ -43,4 +37,12 @@ class Category extends Component
|
||||
|
||||
return $transaction->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function transactionjournals()
|
||||
{
|
||||
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use FireflyIII\Shared\SingleTableInheritanceEntity;
|
||||
|
||||
|
||||
/**
|
||||
* Component
|
||||
*
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
|
||||
/**
|
||||
* Importentry
|
||||
*
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Importmap
|
||||
*
|
||||
|
@ -4,6 +4,7 @@ use Carbon\Carbon;
|
||||
use Illuminate\Database\QueryException;
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Limit
|
||||
*
|
||||
|
@ -3,6 +3,7 @@
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* LimitRepetition
|
||||
*
|
||||
|
@ -2,6 +2,7 @@
|
||||
use Carbon\Carbon;
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Piggybank
|
||||
*
|
||||
@ -19,8 +20,8 @@ use LaravelBook\Ardent\Ardent as Ardent;
|
||||
* @property integer $rep_times
|
||||
* @property string $reminder
|
||||
* @property integer $reminder_skip
|
||||
* @property boolean $remind_me
|
||||
* @property integer $order
|
||||
* @property boolean $remind_me
|
||||
* @property-read \Account $account
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankRepetition[] $piggybankrepetitions
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankEvent[] $piggybankevents
|
||||
@ -39,8 +40,8 @@ use LaravelBook\Ardent\Ardent as Ardent;
|
||||
* @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 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 whereRemindMe($value)
|
||||
*/
|
||||
class Piggybank extends Ardent
|
||||
{
|
||||
@ -70,7 +71,8 @@ class Piggybank extends Ardent
|
||||
return $this->belongsTo('Account');
|
||||
}
|
||||
|
||||
public function countFutureReminders() {
|
||||
public function countFutureReminders()
|
||||
{
|
||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
|
||||
@ -85,6 +87,7 @@ class Piggybank extends Ardent
|
||||
$reminders++;
|
||||
$start = $dateKit->addPeriod($start, $this->reminder, $this->reminder_skip);
|
||||
}
|
||||
|
||||
return $reminders;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* PiggybankEvent
|
||||
*
|
||||
@ -11,13 +12,16 @@ use LaravelBook\Ardent\Ardent as Ardent;
|
||||
* @property integer $piggybank_id
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property float $amount
|
||||
* @property integer $transaction_journal_id
|
||||
* @property-read \Piggybank $piggybank
|
||||
* @property-read \TransactionJournal $transactionJournal
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\PiggybankEvent wherePiggybankId($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
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* PiggybankRepetition
|
||||
*
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* Preference
|
||||
*
|
||||
|
@ -2,6 +2,7 @@
|
||||
use Carbon\Carbon;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
|
||||
|
||||
/**
|
||||
* RecurringTransaction
|
||||
*
|
||||
@ -11,13 +12,14 @@ use LaravelBook\Ardent\Ardent;
|
||||
* @property integer $user_id
|
||||
* @property string $name
|
||||
* @property string $match
|
||||
* @property float $amount_max
|
||||
* @property float $amount_min
|
||||
* @property float $amount_max
|
||||
* @property \Carbon\Carbon $date
|
||||
* @property boolean $active
|
||||
* @property boolean $automatch
|
||||
* @property string $repeat_freq
|
||||
* @property integer $skip
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
|
||||
* @property-read \User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereCreatedAt($value)
|
||||
@ -25,8 +27,8 @@ use LaravelBook\Ardent\Ardent;
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereUserId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereMatch($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAmountMax($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAmountMin($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAmountMax($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereDate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereActive($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\RecurringTransaction whereAutomatch($value)
|
||||
@ -51,14 +53,24 @@ class RecurringTransaction extends Ardent
|
||||
return ['created_at', 'updated_at', 'date'];
|
||||
}
|
||||
|
||||
public function lastFoundMatch() {
|
||||
public function lastFoundMatch()
|
||||
{
|
||||
$last = $this->transactionjournals()->orderBy('date', 'DESC')->first();
|
||||
if ($last) {
|
||||
return $last->date;
|
||||
}
|
||||
|
||||
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
|
||||
* transaction.
|
||||
@ -110,15 +122,8 @@ class RecurringTransaction extends Ardent
|
||||
$start = $dateKit->addPeriod($start, $this->repeat_freq, 0);
|
||||
$counter++;
|
||||
}
|
||||
return $finalDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function transactionjournals()
|
||||
{
|
||||
return $this->hasMany('TransactionJournal');
|
||||
return $finalDate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,6 +13,8 @@ use LaravelBook\Ardent\Ardent;
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property \Carbon\Carbon $enddate
|
||||
* @property boolean $active
|
||||
* @property string $title
|
||||
* @property string $data
|
||||
* @property-read \User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereCreatedAt($value)
|
||||
@ -21,6 +23,8 @@ use LaravelBook\Ardent\Ardent;
|
||||
* @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
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
use LaravelBook\Ardent\Builder;
|
||||
|
||||
@ -18,10 +17,10 @@ use LaravelBook\Ardent\Builder;
|
||||
* @property string $description
|
||||
* @property float $amount
|
||||
* @property-read \Account $account
|
||||
* @property-read \Piggybank $piggybank
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Budget[] $budgets
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Category[] $categories
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
||||
* @property-read \Piggybank $piggybank
|
||||
* @property-read \TransactionJournal $transactionJournal
|
||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Transaction whereCreatedAt($value)
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
|
||||
/**
|
||||
* TransactionCurrency
|
||||
*
|
||||
|
@ -4,6 +4,7 @@ use Carbon\Carbon;
|
||||
use LaravelBook\Ardent\Ardent;
|
||||
use LaravelBook\Ardent\Builder;
|
||||
|
||||
|
||||
/**
|
||||
* TransactionJournal
|
||||
*
|
||||
@ -22,6 +23,7 @@ use LaravelBook\Ardent\Builder;
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\
|
||||
* 'Category[] $categories
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Component[] $components
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\PiggybankEvent[] $piggybankevents
|
||||
* @property-read \RecurringTransaction $recurringTransaction
|
||||
* @property-read \TransactionCurrency $transactionCurrency
|
||||
* @property-read \TransactionType $transactionType
|
||||
@ -41,8 +43,8 @@ use LaravelBook\Ardent\Builder;
|
||||
* @method static \TransactionJournal after($date)
|
||||
* @method static \TransactionJournal before($date)
|
||||
* @method static \TransactionJournal defaultSorting()
|
||||
* @method static \TransactionJournal moreThan($amount)
|
||||
* @method static \TransactionJournal lessThan($amount)
|
||||
* @method static \TransactionJournal moreThan($amount)
|
||||
* @method static \TransactionJournal onDate($date)
|
||||
* @method static \TransactionJournal transactionTypes($types)
|
||||
* @method static \TransactionJournal withRelevantData()
|
||||
@ -106,6 +108,14 @@ class TransactionJournal extends Ardent
|
||||
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
|
||||
*/
|
||||
@ -138,14 +148,6 @@ class TransactionJournal extends Ardent
|
||||
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 Carbon $date
|
||||
|
@ -14,10 +14,7 @@
|
||||
ClassLoader::addDirectories(
|
||||
[
|
||||
|
||||
app_path() . '/commands',
|
||||
app_path() . '/controllers',
|
||||
app_path() . '/models',
|
||||
app_path() . '/database/seeds',
|
||||
app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/database/seeds',
|
||||
|
||||
]
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -54,4 +54,4 @@ return array(
|
||||
|
||||
'storage' => __DIR__ . '/../app/storage',
|
||||
|
||||
);
|
||||
];
|
||||
|
@ -38,10 +38,7 @@ $app = new Illuminate\Foundation\Application;
|
||||
*/
|
||||
|
||||
$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'] .
|
||||
'/vendor/laravel/framework/src';
|
||||
$framework = $app['path.base'] . '/vendor/laravel/framework/src';
|
||||
|
||||
require $framework . '/Illuminate/Foundation/start.php';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user