From 3dce1949302c69009584cc5f090cd4cf4a850c8d Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 21 Nov 2014 11:12:22 +0100
Subject: [PATCH] Use facades.
---
app/controllers/GoogleChartController.php | 12 ++---
app/controllers/HomeController.php | 10 +---
app/controllers/PiggybankController.php | 10 +---
app/controllers/ReminderController.php | 9 +---
app/controllers/TransactionController.php | 16 +++---
app/filters.php | 13 ++---
app/lib/FireflyIII/Database/Budget.php | 2 +-
app/lib/FireflyIII/Database/Recurring.php | 4 +-
.../Database/TransactionJournal.php | 2 +-
app/lib/FireflyIII/Event/Budget.php | 4 +-
app/lib/FireflyIII/FF3ServiceProvider.php | 49 +++++++++++++++++++
app/lib/FireflyIII/Shared/Facade/DateKit.php | 16 ++++++
app/lib/FireflyIII/Shared/Facade/FFForm.php | 16 ++++++
app/lib/FireflyIII/Shared/Facade/Filter.php | 16 ++++++
.../FireflyIII/Shared/Facade/Navigation.php | 16 ++++++
.../FireflyIII/Shared/Facade/Reminders.php | 16 ++++++
app/lib/FireflyIII/Shared/Toolkit/Date.php | 1 +
.../FireflyIII/Shared/Toolkit/Reminders.php | 16 ++----
app/models/RecurringTransaction.php | 12 ++---
app/models/Reminder.php | 4 +-
app/views/reminders/show.blade.php | 1 +
bootstrap/start.php | 22 +++++----
22 files changed, 177 insertions(+), 90 deletions(-)
create mode 100644 app/lib/FireflyIII/Shared/Facade/DateKit.php
create mode 100644 app/lib/FireflyIII/Shared/Facade/FFForm.php
create mode 100644 app/lib/FireflyIII/Shared/Facade/Filter.php
create mode 100644 app/lib/FireflyIII/Shared/Facade/Navigation.php
create mode 100644 app/lib/FireflyIII/Shared/Facade/Reminders.php
diff --git a/app/controllers/GoogleChartController.php b/app/controllers/GoogleChartController.php
index a822f6deca..1aec3d005c 100644
--- a/app/controllers/GoogleChartController.php
+++ b/app/controllers/GoogleChartController.php
@@ -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));
}
diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php
index 938812f079..9617608efc 100644
--- a/app/controllers/HomeController.php
+++ b/app/controllers/HomeController.php
@@ -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');
}
}
\ No newline at end of file
diff --git a/app/controllers/PiggybankController.php b/app/controllers/PiggybankController.php
index 2e9cd7fbfb..15bc390f62 100644
--- a/app/controllers/PiggybankController.php
+++ b/app/controllers/PiggybankController.php
@@ -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.
diff --git a/app/controllers/ReminderController.php b/app/controllers/ReminderController.php
index e7862f289a..e6bdef5ea0 100644
--- a/app/controllers/ReminderController.php
+++ b/app/controllers/ReminderController.php
@@ -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,
diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php
index 56df20531f..7a8cbdcae0 100644
--- a/app/controllers/TransactionController.php
+++ b/app/controllers/TransactionController.php
@@ -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) {
diff --git a/app/filters.php b/app/filters.php
index de94e1a05e..49ca4c8666 100644
--- a/app/filters.php
+++ b/app/filters.php
@@ -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);
diff --git a/app/lib/FireflyIII/Database/Budget.php b/app/lib/FireflyIII/Database/Budget.php
index 6cb68ae838..2d4a0474e5 100644
--- a/app/lib/FireflyIII/Database/Budget.php
+++ b/app/lib/FireflyIII/Database/Budget.php
@@ -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'
diff --git a/app/lib/FireflyIII/Database/Recurring.php b/app/lib/FireflyIII/Database/Recurring.php
index 8a400ac89c..6329cde2ec 100644
--- a/app/lib/FireflyIII/Database/Recurring.php
+++ b/app/lib/FireflyIII/Database/Recurring.php
@@ -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']);
diff --git a/app/lib/FireflyIII/Database/TransactionJournal.php b/app/lib/FireflyIII/Database/TransactionJournal.php
index 040ee14989..b7c2ce5a75 100644
--- a/app/lib/FireflyIII/Database/TransactionJournal.php
+++ b/app/lib/FireflyIII/Database/TransactionJournal.php
@@ -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);
}
diff --git a/app/lib/FireflyIII/Event/Budget.php b/app/lib/FireflyIII/Event/Budget.php
index 063838fe27..087d23c968 100644
--- a/app/lib/FireflyIII/Event/Budget.php
+++ b/app/lib/FireflyIII/Event/Budget.php
@@ -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();
diff --git a/app/lib/FireflyIII/FF3ServiceProvider.php b/app/lib/FireflyIII/FF3ServiceProvider.php
index 9aba717cfe..65231c2352 100644
--- a/app/lib/FireflyIII/FF3ServiceProvider.php
+++ b/app/lib/FireflyIII/FF3ServiceProvider.php
@@ -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');
+ }
+ );
+
}
}
\ No newline at end of file
diff --git a/app/lib/FireflyIII/Shared/Facade/DateKit.php b/app/lib/FireflyIII/Shared/Facade/DateKit.php
new file mode 100644
index 0000000000..387d3c7372
--- /dev/null
+++ b/app/lib/FireflyIII/Shared/Facade/DateKit.php
@@ -0,0 +1,16 @@
+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();
diff --git a/app/models/RecurringTransaction.php b/app/models/RecurringTransaction.php
index db852bfea9..7c54f69e1c 100644
--- a/app/models/RecurringTransaction.php
+++ b/app/models/RecurringTransaction.php
@@ -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++;
}
diff --git a/app/models/Reminder.php b/app/models/Reminder.php
index 7742909eef..a8d02ee414 100644
--- a/app/models/Reminder.php
+++ b/app/models/Reminder.php
@@ -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'));
diff --git a/app/views/reminders/show.blade.php b/app/views/reminders/show.blade.php
index 30e8f544e7..34d02d9865 100644
--- a/app/views/reminders/show.blade.php
+++ b/app/views/reminders/show.blade.php
@@ -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 {{{$reminder->remindersable->name}}}
in order to make your goal of saving {{mf($reminder->remindersable->targetamount)}} on {{$reminder->remindersable->targetdate->format('j F Y')}}
+
@endif
diff --git a/bootstrap/start.php b/bootstrap/start.php
index ac8176b74e..df2b9bde6c 100644
--- a/bootstrap/start.php
+++ b/bootstrap/start.php
@@ -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;