mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Use facades.
This commit is contained in:
parent
ec776bb6eb
commit
3dce194930
@ -499,9 +499,6 @@ class GoogleChartController extends BaseController
|
||||
public function recurringOverview(RecurringTransaction $recurring)
|
||||
{
|
||||
|
||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
|
||||
/** @var \Grumpydictator\Gchart\GChart $chart */
|
||||
$chart = App::make('gchart');
|
||||
$chart->addColumn('Date', 'date');
|
||||
@ -526,7 +523,7 @@ class GoogleChartController extends BaseController
|
||||
}
|
||||
unset($result);
|
||||
$chart->addRow(clone $start, $recurring->amount_max, $recurring->amount_min, $amount);
|
||||
$start = $dateKit->addPeriod($start, $recurring->repeat_freq, 0);
|
||||
$start = DateKit::addPeriod($start, $recurring->repeat_freq, 0);
|
||||
}
|
||||
|
||||
$chart->generate();
|
||||
@ -557,9 +554,6 @@ class GoogleChartController extends BaseController
|
||||
/** @var \FireflyIII\Database\Recurring $rcr */
|
||||
$rcr = App::make('FireflyIII\Database\Recurring');
|
||||
|
||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
|
||||
$recurring = $rcr->get();
|
||||
|
||||
/** @var \RecurringTransaction $entry */
|
||||
@ -580,7 +574,7 @@ class GoogleChartController extends BaseController
|
||||
* Get end of period for $current:
|
||||
*/
|
||||
$currentEnd = clone $current;
|
||||
$dateKit->endOfPeriod($currentEnd, $entry->repeat_freq);
|
||||
DateKit::endOfPeriod($currentEnd, $entry->repeat_freq);
|
||||
|
||||
/*
|
||||
* In the current session range?
|
||||
@ -605,7 +599,7 @@ class GoogleChartController extends BaseController
|
||||
/*
|
||||
* Add some time for the next loop!
|
||||
*/
|
||||
$dateKit->addPeriod($current, $entry->repeat_freq, intval($entry->skip));
|
||||
DateKit::addPeriod($current, $entry->repeat_freq, intval($entry->skip));
|
||||
|
||||
}
|
||||
|
||||
|
@ -84,12 +84,9 @@ class HomeController extends BaseController
|
||||
*/
|
||||
public function sessionNext()
|
||||
{
|
||||
/** @var \FireflyIII\Shared\Toolkit\Navigation $navigation */
|
||||
$navigation = App::make('FireflyIII\Shared\Toolkit\Navigation');
|
||||
$navigation->next();
|
||||
Navigation::next();
|
||||
|
||||
return Redirect::back();
|
||||
//return Redirect::route('index');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,11 +94,8 @@ class HomeController extends BaseController
|
||||
*/
|
||||
public function sessionPrev()
|
||||
{
|
||||
/** @var \FireflyIII\Shared\Toolkit\Navigation $navigation */
|
||||
$navigation = App::make('FireflyIII\Shared\Toolkit\Navigation');
|
||||
$navigation->prev();
|
||||
Navigation::prev();
|
||||
|
||||
return Redirect::back();
|
||||
//return Redirect::route('index');
|
||||
}
|
||||
}
|
@ -48,13 +48,10 @@ class PiggybankController extends BaseController
|
||||
/** @var \FireflyIII\Database\Account $acct */
|
||||
$acct = App::make('FireflyIII\Database\Account');
|
||||
|
||||
/** @var \FireflyIII\Shared\Toolkit\Form $toolkit */
|
||||
$toolkit = App::make('FireflyIII\Shared\Toolkit\Form');
|
||||
|
||||
$periods = Config::get('firefly.piggybank_periods');
|
||||
|
||||
|
||||
$accounts = $toolkit->makeSelectList($acct->getAssetAccounts());
|
||||
$accounts = FFForm::makeSelectList($acct->getAssetAccounts());
|
||||
|
||||
return View::make('piggybanks.create', compact('accounts', 'periods'))->with('title', 'Piggy banks')->with('mainTitleIcon', 'fa-sort-amount-asc')->with(
|
||||
'subTitle', 'Create new piggy bank'
|
||||
@ -99,12 +96,9 @@ class PiggybankController extends BaseController
|
||||
/** @var \FireflyIII\Database\Account $acct */
|
||||
$acct = App::make('FireflyIII\Database\Account');
|
||||
|
||||
/** @var \FireflyIII\Shared\Toolkit\Form $toolkit */
|
||||
$toolkit = App::make('FireflyIII\Shared\Toolkit\Form');
|
||||
|
||||
$periods = Config::get('firefly.piggybank_periods');
|
||||
|
||||
$accounts = $toolkit->makeSelectList($acct->getAssetAccounts());
|
||||
$accounts = FFForm::makeSelectList($acct->getAssetAccounts());
|
||||
|
||||
/*
|
||||
* Flash some data to fill the form.
|
||||
|
@ -21,20 +21,15 @@ class ReminderController extends BaseController
|
||||
{
|
||||
|
||||
$amount = null;
|
||||
$actionURL = '#';
|
||||
if (get_class($reminder->remindersable) == 'Piggybank') {
|
||||
/** @var \FireflyIII\Shared\Toolkit\Reminders $toolkit */
|
||||
$reminderKit = App::make('FireflyIII\Shared\Toolkit\Reminders');
|
||||
|
||||
$amount = $reminderKit->amountForReminder($reminder);
|
||||
$amount = Reminders::amountForReminder($reminder);
|
||||
}
|
||||
|
||||
return View::make('reminders.show', compact('reminder', 'amount'));
|
||||
}
|
||||
|
||||
public function act(Reminder $reminder) {
|
||||
/** @var \FireflyIII\Shared\Toolkit\Reminders $toolkit */
|
||||
$reminderKit = App::make('FireflyIII\Shared\Toolkit\Reminders');
|
||||
|
||||
switch(get_class($reminder->remindersable)) {
|
||||
default:
|
||||
@ -42,7 +37,7 @@ class ReminderController extends BaseController
|
||||
break;
|
||||
break;
|
||||
case 'Piggybank':
|
||||
$amount = $reminderKit->amountForReminder($reminder);
|
||||
$amount = Reminders::amountForReminder($reminder);
|
||||
$prefilled = [
|
||||
'amount' => round($amount,2),
|
||||
'description' => 'Money for ' . $reminder->remindersable->name,
|
||||
|
@ -34,8 +34,6 @@ class TransactionController extends BaseController
|
||||
/*
|
||||
* The repositories we need:
|
||||
*/
|
||||
/** @var \FireflyIII\Shared\Toolkit\Form $form */
|
||||
$form = App::make('FireflyIII\Shared\Toolkit\Form');
|
||||
|
||||
/** @var \FireflyIII\Database\Account $accountRepository */
|
||||
$accountRepository = App::make('FireflyIII\Database\Account');
|
||||
@ -47,14 +45,14 @@ class TransactionController extends BaseController
|
||||
$piggyRepository = App::make('FireflyIII\Database\Piggybank');
|
||||
|
||||
// get asset accounts with names and id's .
|
||||
$assetAccounts = $form->makeSelectList($accountRepository->getAssetAccounts());
|
||||
$assetAccounts = FFForm::makeSelectList($accountRepository->getAssetAccounts());
|
||||
|
||||
// get budgets as a select list.
|
||||
$budgets = $form->makeSelectList($budgetRepository->get());
|
||||
$budgets = FFForm::makeSelectList($budgetRepository->get());
|
||||
$budgets[0] = '(no budget)';
|
||||
|
||||
// get the piggy banks.
|
||||
$piggies = $form->makeSelectList($piggyRepository->get());
|
||||
$piggies = FFForm::makeSelectList($piggyRepository->get());
|
||||
$piggies[0] = '(no piggy bank)';
|
||||
|
||||
/*
|
||||
@ -135,8 +133,6 @@ class TransactionController extends BaseController
|
||||
/*
|
||||
* All the repositories we need:
|
||||
*/
|
||||
/** @var \FireflyIII\Shared\Toolkit\Form $form */
|
||||
$form = App::make('FireflyIII\Shared\Toolkit\Form');
|
||||
|
||||
/** @var \FireflyIII\Database\Account $accountRepository */
|
||||
$accountRepository = App::make('FireflyIII\Database\Account');
|
||||
@ -152,10 +148,10 @@ class TransactionController extends BaseController
|
||||
$what = strtolower($journal->transactiontype->type);
|
||||
|
||||
// get asset accounts with names and id's.
|
||||
$accounts = $form->makeSelectList($accountRepository->getAssetAccounts());
|
||||
$accounts = FFForm::makeSelectList($accountRepository->getAssetAccounts());
|
||||
|
||||
// get budgets as a select list.
|
||||
$budgets = $form->makeSelectList($budgetRepository->get());
|
||||
$budgets = FFForm::makeSelectList($budgetRepository->get());
|
||||
$budgets[0] = '(no budget)';
|
||||
|
||||
/*
|
||||
@ -163,7 +159,7 @@ class TransactionController extends BaseController
|
||||
* of the transactions in the journal has this field, it should all fill in nicely.
|
||||
*/
|
||||
// get the piggy banks.
|
||||
$piggies = $form->makeSelectList($piggyRepository->get());
|
||||
$piggies = FFForm::makeSelectList($piggyRepository->get());
|
||||
$piggies[0] = '(no piggy bank)';
|
||||
$piggyBankId = 0;
|
||||
foreach ($journal->transactions as $t) {
|
||||
|
@ -7,16 +7,9 @@ App::before(
|
||||
$reminders = [];
|
||||
|
||||
if (Auth::check()) {
|
||||
/** @var \FireflyIII\Shared\Toolkit\Filter $toolkit */
|
||||
$filter = App::make('FireflyIII\Shared\Toolkit\Filter');
|
||||
$filter->setSessionDateRange();
|
||||
|
||||
/** @var \FireflyIII\Shared\Toolkit\Reminders $toolkit */
|
||||
$reminderKit = App::make('FireflyIII\Shared\Toolkit\Reminders');
|
||||
|
||||
$reminderKit->updateReminders();
|
||||
$reminders = $reminderKit->getReminders();
|
||||
|
||||
Filter::setSessionDateRange();
|
||||
Reminders::updateReminders();
|
||||
$reminders = Reminders::getReminders();
|
||||
}
|
||||
View::share('reminders', $reminders);
|
||||
|
||||
|
@ -238,7 +238,7 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
public function transactionsWithoutBudgetInDateRange(Carbon $start, Carbon $end)
|
||||
{
|
||||
// Add expenses that have no budget:
|
||||
return \Auth::user()->transactionjournals()->whereNotIn(
|
||||
return $this->getUser()->transactionjournals()->whereNotIn(
|
||||
'transaction_journals.id', function ($query) use ($start, $end) {
|
||||
$query->select('transaction_journals.id')->from('transaction_journals')->leftJoin(
|
||||
'component_transaction_journal', 'component_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
|
||||
|
@ -67,9 +67,7 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
|
||||
/*
|
||||
* Jump to the start of the period.
|
||||
*/
|
||||
/** @var \FireflyIII\Shared\Toolkit\Date $toolkit */
|
||||
$toolkit = \App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
$date = $toolkit->startOfPeriod($date, $data['repeat_freq']);
|
||||
$date = DateKit::startOfPeriod($date, $data['repeat_freq']);
|
||||
$recurring->date = $date;
|
||||
$recurring->skip = intval($data['skip']);
|
||||
|
||||
|
@ -407,7 +407,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
// }
|
||||
|
||||
|
||||
$validator = \Validator::make([$model], \Transaction::$rules);
|
||||
$validator = \Validator::make([$model], \TransactionJournal::$rules);
|
||||
if ($validator->invalid()) {
|
||||
$errors->merge($errors);
|
||||
}
|
||||
|
@ -13,11 +13,9 @@ class Budget
|
||||
*/
|
||||
public function storeOrUpdateLimit(\Limit $limit)
|
||||
{
|
||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||
$dateKit = \App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
|
||||
|
||||
$end = $dateKit->addPeriod(clone $limit->startdate, $limit->repeat_freq, 0);
|
||||
$end = DateKit::addPeriod(clone $limit->startdate, $limit->repeat_freq, 0);
|
||||
$end->subDay();
|
||||
|
||||
$set = $limit->limitrepetitions()->where('startdate', $limit->startdate->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))->get();
|
||||
|
@ -2,6 +2,7 @@
|
||||
namespace FireflyIII;
|
||||
|
||||
use FireflyIII\Shared\Validation\FireflyValidator;
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
@ -21,6 +22,16 @@ class FF3ServiceProvider extends ServiceProvider
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the services bla bla.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return ['reminders', 'filters', 'datekit', 'navigation'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered automatically by Laravel
|
||||
*/
|
||||
@ -29,12 +40,50 @@ class FF3ServiceProvider extends ServiceProvider
|
||||
// FORMAT:
|
||||
#$this->app->bind('Interface', 'Class');
|
||||
|
||||
$this->app->bind(
|
||||
'reminders', function () {
|
||||
return new \FireflyIII\Shared\Toolkit\Reminders;
|
||||
}
|
||||
);
|
||||
$this->app->bind(
|
||||
'filter', function () {
|
||||
return new \FireflyIII\Shared\Toolkit\Filter;
|
||||
}
|
||||
);
|
||||
$this->app->bind(
|
||||
'datekit', function () {
|
||||
return new \FireflyIII\Shared\Toolkit\Date;
|
||||
}
|
||||
);
|
||||
$this->app->bind(
|
||||
'navigation', function () {
|
||||
return new \FireflyIII\Shared\Toolkit\Navigation;
|
||||
}
|
||||
);
|
||||
$this->app->bind(
|
||||
'ffform', function () {
|
||||
return new \FireflyIII\Shared\Toolkit\Form;
|
||||
}
|
||||
);
|
||||
|
||||
// preferences:
|
||||
$this->app->bind('FireflyIII\Shared\Preferences\PreferencesInterface', 'FireflyIII\Shared\Preferences\Preferences');
|
||||
|
||||
// registration and user mail:
|
||||
$this->app->bind('FireflyIII\Shared\Mail\RegistrationInterface', 'FireflyIII\Shared\Mail\Registration');
|
||||
|
||||
// Shortcut so developers don't need to add an Alias in app/config/app.php
|
||||
$this->app->booting(
|
||||
function () {
|
||||
$loader = AliasLoader::getInstance();
|
||||
$loader->alias('Reminders', 'FireflyIII\Shared\Facade\Reminders');
|
||||
$loader->alias('Filter', 'FireflyIII\Shared\Facade\Filter');
|
||||
$loader->alias('DateKit', 'FireflyIII\Shared\Facade\DateKit');
|
||||
$loader->alias('Navigation', 'FireflyIII\Shared\Facade\Navigation');
|
||||
$loader->alias('FFForm', 'FireflyIII\Shared\Facade\FFForm');
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
16
app/lib/FireflyIII/Shared/Facade/DateKit.php
Normal file
16
app/lib/FireflyIII/Shared/Facade/DateKit.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Shared\Facade;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class DateKit extends Facade
|
||||
{
|
||||
|
||||
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'datekit';
|
||||
}
|
||||
|
||||
}
|
16
app/lib/FireflyIII/Shared/Facade/FFForm.php
Normal file
16
app/lib/FireflyIII/Shared/Facade/FFForm.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Shared\Facade;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class FFForm extends Facade
|
||||
{
|
||||
|
||||
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'ffform';
|
||||
}
|
||||
|
||||
}
|
16
app/lib/FireflyIII/Shared/Facade/Filter.php
Normal file
16
app/lib/FireflyIII/Shared/Facade/Filter.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Shared\Facade;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Filter extends Facade
|
||||
{
|
||||
|
||||
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'filter';
|
||||
}
|
||||
|
||||
}
|
16
app/lib/FireflyIII/Shared/Facade/Navigation.php
Normal file
16
app/lib/FireflyIII/Shared/Facade/Navigation.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Shared\Facade;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Navigation extends Facade
|
||||
{
|
||||
|
||||
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'navigation';
|
||||
}
|
||||
|
||||
}
|
16
app/lib/FireflyIII/Shared/Facade/Reminders.php
Normal file
16
app/lib/FireflyIII/Shared/Facade/Reminders.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Shared\Facade;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Reminders extends Facade
|
||||
{
|
||||
|
||||
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'reminders';
|
||||
}
|
||||
|
||||
}
|
@ -22,6 +22,7 @@ class Date
|
||||
*/
|
||||
public function addPeriod(Carbon $date, $repeatFreq, $skip)
|
||||
{
|
||||
// TODO clone the dates so referred date won't be altered.
|
||||
$add = ($skip + 1);
|
||||
switch ($repeatFreq) {
|
||||
default:
|
||||
|
@ -23,9 +23,6 @@ class Reminders
|
||||
public function amountForReminder(\Reminder $reminder)
|
||||
{
|
||||
|
||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||
$dateKit = \App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
|
||||
switch (get_class($reminder->remindersable)) {
|
||||
|
||||
case 'Piggybank':
|
||||
@ -34,7 +31,7 @@ class Reminders
|
||||
$reminders = 0;
|
||||
while ($start <= $end) {
|
||||
$reminders++;
|
||||
$start = $dateKit->addPeriod($start, $reminder->remindersable->reminder, $reminder->remindersable->reminder_skip);
|
||||
$start = DateKit::addPeriod($start, $reminder->remindersable->reminder, $reminder->remindersable->reminder_skip);
|
||||
}
|
||||
/*
|
||||
* Now find amount yet to save.
|
||||
@ -49,9 +46,6 @@ class Reminders
|
||||
throw new FireflyException('Cannot handle class ' . get_class($reminder->remindersable) . ' in amountForReminder.');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return 50;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,10 +71,6 @@ class Reminders
|
||||
/** @var \FireflyIII\Database\Piggybank $repository */
|
||||
$repository = \App::make('FireflyIII\Database\Piggybank');
|
||||
|
||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||
$dateKit = \App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
|
||||
|
||||
/** @var Collection $piggybanks */
|
||||
$piggybanks = $repository->get();
|
||||
$set = $piggybanks->filter(
|
||||
@ -100,12 +90,12 @@ class Reminders
|
||||
*/
|
||||
/** @var \PiggybankRepetition $repetition */
|
||||
$repetition = $piggybank->currentRelevantRep();
|
||||
$start = $dateKit->startOfPeriod(Carbon::now(), $piggybank->reminder);
|
||||
$start = DateKit::startOfPeriod(Carbon::now(), $piggybank->reminder);
|
||||
if ($repetition->targetdate && $repetition->targetdate <= Carbon::now()) {
|
||||
// break when no longer relevant:
|
||||
continue;
|
||||
}
|
||||
$end = $dateKit->endOfPeriod(clone $start, $piggybank->reminder);
|
||||
$end = DateKit::endOfPeriod(clone $start, $piggybank->reminder);
|
||||
// should have a reminder for this period:
|
||||
/** @var \Collection $reminders */
|
||||
$reminders = $piggybank->reminders()->dateIs($start, $end)->get();
|
||||
|
@ -83,6 +83,7 @@ class RecurringTransaction extends Ardent
|
||||
return $this->hasMany('TransactionJournal');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO remove this method in favour of something in the FireflyIII libraries.
|
||||
*
|
||||
@ -92,9 +93,6 @@ class RecurringTransaction extends Ardent
|
||||
public function nextExpectedMatch()
|
||||
{
|
||||
|
||||
/** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||
$dateKit = App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
|
||||
/*
|
||||
* The date Firefly tries to find. If this stays null, it's "unknown".
|
||||
*/
|
||||
@ -104,14 +102,14 @@ class RecurringTransaction extends Ardent
|
||||
* $today is the start of the next period, to make sure FF3 won't miss anything
|
||||
* when the current period has a transaction journal.
|
||||
*/
|
||||
$today = $dateKit->addPeriod(new Carbon, $this->repeat_freq, 0);
|
||||
$today = DateKit::addPeriod(new Carbon, $this->repeat_freq, 0);
|
||||
|
||||
/*
|
||||
* FF3 loops from the $start of the recurring transaction, and to make sure
|
||||
* $skip works, it adds one (for modulo).
|
||||
*/
|
||||
$skip = $this->skip + 1;
|
||||
$start = $dateKit->startOfPeriod(new Carbon, $this->repeat_freq);
|
||||
$start = DateKit::startOfPeriod(new Carbon, $this->repeat_freq);
|
||||
/*
|
||||
* go back exactly one month/week/etc because FF3 does not care about 'next'
|
||||
* recurring transactions if they're too far into the past.
|
||||
@ -124,7 +122,7 @@ class RecurringTransaction extends Ardent
|
||||
while ($start <= $today) {
|
||||
if (($counter % $skip) == 0) {
|
||||
// do something.
|
||||
$end = $dateKit->endOfPeriod(clone $start, $this->repeat_freq);
|
||||
$end = DateKit::endOfPeriod(clone $start, $this->repeat_freq);
|
||||
$journalCount = $this->transactionjournals()->before($end)->after($start)->count();
|
||||
if ($journalCount == 0) {
|
||||
$finalDate = clone $start;
|
||||
@ -133,7 +131,7 @@ class RecurringTransaction extends Ardent
|
||||
}
|
||||
|
||||
// add period for next round!
|
||||
$start = $dateKit->addPeriod($start, $this->repeat_freq, 0);
|
||||
$start = DateKit::addPeriod($start, $this->repeat_freq, 0);
|
||||
$counter++;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ use LaravelBook\Ardent\Ardent;
|
||||
* @property boolean $active
|
||||
* @property integer $remembersable_id
|
||||
* @property string $remembersable_type
|
||||
* @property-read \ $remindersable
|
||||
* @property-read \Piggybank $remindersable
|
||||
* @property-read \User $user
|
||||
* @property mixed $data
|
||||
* @method static \Illuminate\Database\Query\Builder|\Reminder whereId($value)
|
||||
@ -62,6 +62,8 @@ class Reminder extends Eloquent
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
|
||||
|
||||
public function scopeDateIs($query, Carbon $start, Carbon $end)
|
||||
{
|
||||
return $query->where('startdate', $start->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'));
|
||||
|
@ -15,6 +15,7 @@
|
||||
Somewhere between {{$reminder->startdate->format('j F Y')}} and {{$reminder->enddate->format('j F Y')}} you
|
||||
should deposit {{mf($amount)}} in piggy bank <a href="{{route('piggybanks.show',$reminder->remindersable_id)}}">{{{$reminder->remindersable->name}}}</a>
|
||||
in order to make your goal of saving {{mf($reminder->remindersable->targetamount)}} on {{$reminder->remindersable->targetdate->format('j F Y')}}
|
||||
|
||||
@endif
|
||||
</p>
|
||||
<p>
|
||||
|
@ -102,13 +102,17 @@ Event::subscribe('FireflyIII\Event\TransactionJournal');
|
||||
// event for when the non-repeating piggy bank is updated because the single repetition must also be changed.
|
||||
// (also make piggy bank events "invalid" when they start falling outside of the date-scope of the piggy bank,
|
||||
// although this not changes the amount in the piggy bank).
|
||||
// TODO check if recurring transactions are being updated when journals are updated (aka no longer fitting, thus removed).
|
||||
// TODO think about reminders.
|
||||
// TODO an event that triggers and creates a limit + limit repetition when a budget is created, or something?
|
||||
// TODO has many through needs to be added wherever relevant. Account > journals, etc.
|
||||
// TODO check all models for "external" methods once more.
|
||||
// TODO Auth::user() should be used very sparsely.
|
||||
// TODO direct calls to models are BAD
|
||||
// TODO cleanup everything related to reminders because it still feels a bit sloppy.
|
||||
// TODO use a Database\Reminder thing instead of self-made ORM.
|
||||
// check if recurring transactions are being updated when journals are updated (aka no longer fitting, thus removed).
|
||||
// think about reminders.
|
||||
// an event that triggers and creates a limit + limit repetition when a budget is created, or something?
|
||||
// has many through needs to be added wherever relevant. Account > journals, etc.
|
||||
// check all models for "external" methods once more.
|
||||
// Auth::user() should be used very sparsely.
|
||||
// direct calls to models are BAD
|
||||
// cleanup everything related to reminders because it still feels a bit sloppy.
|
||||
// use a Database\Reminder thing instead of self-made ORM.
|
||||
// TODO create static calls instead of all the App::make() things.
|
||||
// TODO see if the various has-many-throughs actually get used.
|
||||
// TODO set very tight rules on all models
|
||||
// TODO create custom uniquely rules.
|
||||
return $app;
|
||||
|
Loading…
Reference in New Issue
Block a user