Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Scrutinizer Auto-Fixes
Scrutinizer Auto-Fixer14a7cd05b10a
diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.phpindex 10fb20215e..5bcf09f9d8 100644--- a/app/Helpers/Report/ReportQuery.php+++ b/app/Helpers/Report/ReportQuery.php@@ -94,13 +94,13 @@ class ReportQuery implements ReportQueryInterface->accountTypeIn(['Default account', 'Asset account', 'Cash account']);if ($includeShared === false) {$query->leftJoin(- 'account_meta', function (JoinClause $join) {+ 'account_meta', function(JoinClause $join) {$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');})->orderBy('accounts.name', 'ASC')->where(- function (Builder $query) {+ function(Builder $query) {$query->where('account_meta.data', '!=', '"sharedAsset"');$query->orWhereNull('account_meta.data');@@ -254,24 +254,24 @@ class ReportQuery implements ReportQueryInterface{$query = TransactionJournal::leftJoin(- 'transactions as t_from', function (JoinClause $join) {+ 'transactions as t_from', function(JoinClause $join) {$join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0);})->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id')->leftJoin(- 'account_meta as acm_from', function (JoinClause $join) {+ 'account_meta as acm_from', function(JoinClause $join) {$join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole');})->leftJoin(- 'transactions as t_to', function (JoinClause $join) {+ 'transactions as t_to', function(JoinClause $join) {$join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0);})->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id')->leftJoin(- 'account_meta as acm_to', function (JoinClause $join) {+ 'account_meta as acm_to', function(JoinClause $join) {$join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole');})diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.phpindex 4477dcda9a..92f027ab26 100644--- a/app/Http/Controllers/CategoryController.php+++ b/app/Http/Controllers/CategoryController.php@@ -31,7 +31,7 @@ class CategoryController extends Controller}/**- * @return $this+ * @return \Illuminate\View\View*/public function create(){@@ -84,7 +84,7 @@ class CategoryController extends Controller/*** @param Category $category*- * @return $this+ * @return \Illuminate\View\View*/public function edit(Category $category){@@ -105,14 +105,14 @@ class CategoryController extends Controller/*** @param CategoryRepositoryInterface $repository*- * @return $this+ * @return \Illuminate\View\View*/public function index(CategoryRepositoryInterface $repository){$categories = $repository->getCategories();$categories->each(- function (Category $category) use ($repository) {+ function(Category $category) use ($repository) {$category->lastActivity = $repository->getLatestActivity($category);});@@ -139,7 +139,7 @@ class CategoryController extends Controller* @param CategoryRepositoryInterface $repository* @param Category $category*- * @return View+ * @return \Illuminate\View\View*/public function show(CategoryRepositoryInterface $repository, Category $category){@@ -157,7 +157,7 @@ class CategoryController extends Controller* @param CategoryFormRequest $request* @param CategoryRepositoryInterface $repository*- * @return mixed+ * @return \Illuminate\Http\RedirectResponse*/public function store(CategoryFormRequest $request, CategoryRepositoryInterface $repository){@@ -165,7 +165,7 @@ class CategoryController extends Controller'name' => $request->input('name'),'user' => Auth::user()->id,];- $category = $repository->store($categoryData);+ $category = $repository->store($categoryData);Session::flash('success', 'New category "' . $category->name . '" stored!');diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.phpindex 195b3c4458..445db07672 100644--- a/app/Http/Controllers/Chart/BudgetController.php+++ b/app/Http/Controllers/Chart/BudgetController.php@@ -127,9 +127,9 @@ class BudgetController extends Controller$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;$allEntries->push([$budget->name . ' (' . $repetition->startdate->formatLocalized($this->monthAndDayFormat) . ')',- $left,- $spent,- $overspent+ $left,+ $spent,+ $overspent]);}diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.phpindex bf0781e69e..c6f42cad5b 100644--- a/app/Http/Controllers/Chart/CategoryController.php+++ b/app/Http/Controllers/Chart/CategoryController.php@@ -80,7 +80,7 @@ class CategoryController extends Controller// sort by callback:uasort($set,- function ($left, $right) {+ function($left, $right) {if ($left['sum'] == $right['sum']) {return 0;}diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex ffdf6f4afc..3b09b9f96c 100644--- a/app/Http/Controllers/HomeController.php+++ b/app/Http/Controllers/HomeController.php@@ -73,8 +73,8 @@ class HomeController extends Controllerif ($sum != 0) {Session::flash('error', 'Your transactions are unbalanced. This means a'- . ' withdrawal, deposit or transfer was not stored properly. '- . 'Please check your accounts and transactions for errors.'+ . ' withdrawal, deposit or transfer was not stored properly. '+ . 'Please check your accounts and transactions for errors.');}diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.phpindex 873a5a4bd2..6961b5787b 100644--- a/app/Http/Controllers/PiggyBankController.php+++ b/app/Http/Controllers/PiggyBankController.php@@ -137,11 +137,11 @@ class PiggyBankController extends Controller$targetDate = $targetDate->format('Y-m-d');}$preFilled = ['name' => $piggyBank->name,- 'account_id' => $piggyBank->account_id,- 'targetamount' => $piggyBank->targetamount,- 'targetdate' => $targetDate,- 'reminder' => $piggyBank->reminder,- 'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false+ 'account_id' => $piggyBank->account_id,+ 'targetamount' => $piggyBank->targetamount,+ 'targetdate' => $targetDate,+ 'reminder' => $piggyBank->reminder,+ 'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false];Session::flash('preFilled', $preFilled);Session::flash('gaEventCategory', 'piggy-banks');diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.phpindex f1eee2103f..251a88ea2e 100644--- a/app/Http/Controllers/TagController.php+++ b/app/Http/Controllers/TagController.php@@ -115,7 +115,7 @@ class TagController extends Controller** @param TagRepositoryInterface $repository*- * @return View+ * @return \Illuminate\View\View*/public function edit(Tag $tag, TagRepositoryInterface $repository){@@ -200,7 +200,7 @@ class TagController extends Controller** @param TagRepositoryInterface $repository*- * @return $this|\Illuminate\Http\RedirectResponse+ * @return \Illuminate\Http\RedirectResponse*/public function store(TagFormRequest $request, TagRepositoryInterface $repository){@@ -244,7 +244,7 @@ class TagController extends Controller* @param TagRepositoryInterface $repository* @param Tag $tag*- * @return $this|\Illuminate\Http\RedirectResponse+ * @return \Illuminate\Http\RedirectResponse*/public function update(TagFormRequest $request, TagRepositoryInterface $repository, Tag $tag){diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.phpindex 885d9c9f53..2ebef96f41 100644--- a/app/Http/Controllers/TransactionController.php+++ b/app/Http/Controllers/TransactionController.php@@ -38,7 +38,7 @@ class TransactionController extends Controller* @param AccountRepositoryInterface $repository* @param string $what*- * @return View+ * @return \Illuminate\View\View*/public function create(AccountRepositoryInterface $repository, $what = 'deposit'){@@ -75,7 +75,7 @@ class TransactionController extends Controller** @param TransactionJournal $journal*- * @return $this+ * @return \Illuminate\View\View*/public function delete(TransactionJournal $journal){@@ -178,7 +178,7 @@ class TransactionController extends Controller* @param JournalRepositoryInterface $repository* @param $what*- * @return View+ * @return \Illuminate\View\View*/public function index(JournalRepositoryInterface $repository, $what){@@ -244,12 +244,12 @@ class TransactionController extends Controller* @param JournalRepositoryInterface $repository* @param TransactionJournal $journal*- * @return $this+ * @return \Illuminate\View\View*/public function show(JournalRepositoryInterface $repository, TransactionJournal $journal){$journal->transactions->each(- function (Transaction $t) use ($journal, $repository) {+ function(Transaction $t) use ($journal, $repository) {$t->before = $repository->getAmountBefore($journal, $t);$t->after = $t->before + $t->amount;}@@ -263,7 +263,7 @@ class TransactionController extends Controller* @param JournalFormRequest $request* @param JournalRepositoryInterface $repository*- * @return $this|\Illuminate\Http\RedirectResponse+ * @return \Illuminate\Http\RedirectResponse*/public function store(JournalFormRequest $request, JournalRepositoryInterface $repository){@@ -300,7 +300,7 @@ class TransactionController extends Controller* @param JournalRepositoryInterface $repository* @param TransactionJournal $journal*- * @return $this|\Illuminate\Http\RedirectResponse+ * @return \Illuminate\Http\RedirectResponse*/public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal){diff --git a/app/Http/Middleware/Reminders.php b/app/Http/Middleware/Reminders.phpindex c64c2ad1fa..869b1f170a 100644--- a/app/Http/Middleware/Reminders.php+++ b/app/Http/Middleware/Reminders.php@@ -68,7 +68,7 @@ class Reminders// get and list active reminders:$reminders = $this->auth->user()->reminders()->today()->get();$reminders->each(- function (Reminder $reminder) use ($helper) {+ function(Reminder $reminder) use ($helper) {$reminder->description = $helper->getReminderText($reminder);});diff --git a/app/Http/routes.php b/app/Http/routes.phpindex 02631fcac4..750d9a7b3b 100644--- a/app/Http/routes.php+++ b/app/Http/routes.php@@ -15,13 +15,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;// modelsRoute::bind('account',- function ($value) {+ function($value) {if (Auth::check()) {$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')- ->where('account_types.editable', 1)- ->where('accounts.id', $value)- ->where('user_id', Auth::user()->id)- ->first(['accounts.*']);+ ->where('account_types.editable', 1)+ ->where('accounts.id', $value)+ ->where('user_id', Auth::user()->id)+ ->first(['accounts.*']);if ($object) {return $object;}@@ -31,7 +31,7 @@ Route::bind();Route::bind(- 'tj', function ($value) {+ 'tj', function($value) {if (Auth::check()) {$object = TransactionJournal::where('id', $value)->where('user_id', Auth::user()->id)->first();if ($object) {@@ -44,7 +44,7 @@ Route::bind();Route::bind(- 'currency', function ($value) {+ 'currency', function($value) {if (Auth::check()) {$object = TransactionCurrency::find($value);if ($object) {@@ -56,7 +56,7 @@ Route::bind();Route::bind(- 'bill', function ($value) {+ 'bill', function($value) {if (Auth::check()) {$object = Bill::where('id', $value)->where('user_id', Auth::user()->id)->first();if ($object) {@@ -69,7 +69,7 @@ Route::bind();Route::bind(- 'budget', function ($value) {+ 'budget', function($value) {if (Auth::check()) {$object = Budget::where('id', $value)->where('user_id', Auth::user()->id)->first();if ($object) {@@ -82,7 +82,7 @@ Route::bind();Route::bind(- 'reminder', function ($value) {+ 'reminder', function($value) {if (Auth::check()) {$object = Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first();if ($object) {@@ -95,13 +95,13 @@ Route::bind();Route::bind(- 'limitrepetition', function ($value) {+ 'limitrepetition', function($value) {if (Auth::check()) {$object = LimitRepetition::where('limit_repetitions.id', $value)- ->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')- ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')- ->where('budgets.user_id', Auth::user()->id)- ->first(['limit_repetitions.*']);+ ->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')+ ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')+ ->where('budgets.user_id', Auth::user()->id)+ ->first(['limit_repetitions.*']);if ($object) {return $object;}@@ -112,12 +112,12 @@ Route::bind();Route::bind(- 'piggyBank', function ($value) {+ 'piggyBank', function($value) {if (Auth::check()) {$object = PiggyBank::where('piggy_banks.id', $value)- ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')- ->where('accounts.user_id', Auth::user()->id)- ->first(['piggy_banks.*']);+ ->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')+ ->where('accounts.user_id', Auth::user()->id)+ ->first(['piggy_banks.*']);if ($object) {return $object;}@@ -128,7 +128,7 @@ Route::bind();Route::bind(- 'category', function ($value) {+ 'category', function($value) {if (Auth::check()) {$object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first();if ($object) {@@ -142,7 +142,7 @@ Route::bind(/** @noinspection PhpUnusedParameterInspection */Route::bind(- 'reminder', function ($value) {+ 'reminder', function($value) {if (Auth::check()) {/** @var \FireflyIII\Models\Reminder $object */$object = Reminder::find($value);@@ -158,7 +158,7 @@ Route::bind();Route::bind(- 'tag', function ($value) {+ 'tag', function($value) {if (Auth::check()) {$object = Tag::where('id', $value)->where('user_id', Auth::user()->id)->first();if ($object) {@@ -189,7 +189,7 @@ Route::get('/routes', ['uses' => 'HomeController@routes', 'as' => 'routes']);* Home Controller*/Route::group(- ['middleware' => ['auth', 'range', 'reminders']], function () {+ ['middleware' => ['auth', 'range', 'reminders']], function() {Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index', 'middleware' => 'cleanup']);Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);diff --git a/app/Models/Account.php b/app/Models/Account.phpindex 581c0d48e2..a47a7f75d7 100644--- a/app/Models/Account.php+++ b/app/Models/Account.php@@ -129,7 +129,7 @@ class Account extends Model/*** @codeCoverageIgnore- * @return array+ * @return string[]*/public function getDates(){@@ -138,7 +138,7 @@ class Account extends Model/***- * @param $fieldName+ * @param string $fieldName** @codeCoverageIgnore*@@ -208,7 +208,7 @@ class Account extends Model{$joinName = str_replace('.', '_', $name);$query->leftJoin(- 'account_meta as ' . $joinName, function (JoinClause $join) use ($joinName, $name) {+ 'account_meta as ' . $joinName, function(JoinClause $join) use ($joinName, $name) {$join->on($joinName . '.account_id', '=', 'accounts.id')->where($joinName . '.name', '=', $name);});diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.phpindex 3cd0f95fbe..f3ec8dfb60 100644--- a/app/Models/AccountMeta.php+++ b/app/Models/AccountMeta.php@@ -33,7 +33,7 @@ class AccountMeta extends Model'name' => 'required|between:1,100','data' => 'required'];- protected $table = 'account_meta';+ protected $table = 'account_meta';/***diff --git a/app/Models/Bill.php b/app/Models/Bill.phpindex 845d110cf5..d7517da9c1 100644--- a/app/Models/Bill.php+++ b/app/Models/Bill.php@@ -49,7 +49,7 @@ class Bill extends Model{protected $fillable- = ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip', 'automatch', 'active',];+ = ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip', 'automatch', 'active', ];protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];diff --git a/app/Models/Category.php b/app/Models/Category.phpindex a86bc2fc84..b1cd0f5d71 100644--- a/app/Models/Category.php+++ b/app/Models/Category.php@@ -63,7 +63,7 @@ class Category extends Model/*** @codeCoverageIgnore- * @return array+ * @return string[]*/public function getDates(){diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.phpindex 6d4b904d81..3a60335bef 100644--- a/app/Models/PiggyBank.php+++ b/app/Models/PiggyBank.php@@ -49,7 +49,7 @@ class PiggyBank extends Modeluse SoftDeletes;protected $fillable- = ['name', 'account_id', 'order', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder', 'remind_me'];+ = ['name', 'account_id', 'order', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder', 'remind_me'];protected $hidden = ['targetamount_encrypted', 'encrypted'];/**@@ -88,7 +88,7 @@ class PiggyBank extends Model}/**- * @return array+ * @return string[]*/public function getDates(){@@ -115,7 +115,7 @@ class PiggyBank extends Model** @param $value*- * @return int+ * @return boolean*/public function getRemindMeAttribute($value){diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.phpindex deccd7bbde..699b712c25 100644--- a/app/Models/PiggyBankRepetition.php+++ b/app/Models/PiggyBankRepetition.php@@ -77,13 +77,13 @@ class PiggyBankRepetition extends Model$q->orWhereNull('startdate');})- ->where(- function (EloquentBuilder $q) use ($date) {+ ->where(+ function (EloquentBuilder $q) use ($date) {- $q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));- $q->orWhereNull('targetdate');- }- );+ $q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));+ $q->orWhereNull('targetdate');+ }+ );}/**diff --git a/app/Models/Reminder.php b/app/Models/Reminder.phpindex d46cf56e74..5b0b62bcfd 100644--- a/app/Models/Reminder.php+++ b/app/Models/Reminder.php@@ -43,7 +43,7 @@ class Reminder extends Model{- protected $fillable = ['user_id', 'startdate', 'metadata', 'enddate', 'active', 'notnow', 'remindersable_id', 'remindersable_type',];+ protected $fillable = ['user_id', 'startdate', 'metadata', 'enddate', 'active', 'notnow', 'remindersable_id', 'remindersable_type', ];protected $hidden = ['encrypted'];/**@@ -123,7 +123,7 @@ class Reminder extends Model$today = new Carbon;return $query->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))->where('active', 1)- ->where('notnow', 0);+ ->where('notnow', 0);}/**diff --git a/app/Models/Tag.php b/app/Models/Tag.phpindex 2d973f4bf1..0fb6a9c876 100644--- a/app/Models/Tag.php+++ b/app/Models/Tag.php@@ -89,7 +89,7 @@ class Tag extends Model/*** @codeCoverageIgnore- * @return array+ * @return string[]*/public function getDates(){diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.phpindex 51f7c48e98..212682c5e9 100644--- a/app/Models/TransactionJournal.php+++ b/app/Models/TransactionJournal.php@@ -224,7 +224,7 @@ class TransactionJournal extends Model/*** @codeCoverageIgnore- * @return array+ * @return string[]*/public function getDates(){@@ -313,7 +313,7 @@ class TransactionJournal extends Model* @param EloquentBuilder $query* @param Carbon $date*- * @return mixed+ * @return EloquentBuilder*/public function scopeAfter(EloquentBuilder $query, Carbon $date){@@ -326,7 +326,7 @@ class TransactionJournal extends Model* @param EloquentBuilder $query* @param Carbon $date*- * @return mixed+ * @return EloquentBuilder*/public function scopeBefore(EloquentBuilder $query, Carbon $date){@@ -339,7 +339,7 @@ class TransactionJournal extends Model* @param EloquentBuilder $query* @param Carbon $date*- * @return mixed+ * @return EloquentBuilder*/public function scopeOnDate(EloquentBuilder $query, Carbon $date){@@ -373,7 +373,7 @@ class TransactionJournal extends Modelpublic function scopeWithRelevantData(EloquentBuilder $query){$query->with(- ['transactions' => function (HasMany $q) {+ ['transactions' => function(HasMany $q) {$q->orderBy('amount', 'ASC');}, 'transactiontype', 'transactioncurrency', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories']);diff --git a/app/Providers/BusServiceProvider.php b/app/Providers/BusServiceProvider.phpindex dc2e86ac21..1eef3684d7 100644--- a/app/Providers/BusServiceProvider.php+++ b/app/Providers/BusServiceProvider.php@@ -23,7 +23,7 @@ class BusServiceProvider extends ServiceProviderpublic function boot(Dispatcher $dispatcher){$dispatcher->mapUsing(- function ($command) {+ function($command) {return Dispatcher::simpleMapping($command, 'FireflyIII\Commands', 'FireflyIII\Handlers\Commands');diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.phpindex 9299f12fcb..3e01105bd5 100644--- a/app/Providers/EventServiceProvider.php+++ b/app/Providers/EventServiceProvider.php@@ -52,12 +52,12 @@ class EventServiceProvider extends ServiceProvider$this->registerDeleteEvents();$this->registerCreateEvents();BudgetLimit::saved(- function (BudgetLimit $budgetLimit) {+ function(BudgetLimit $budgetLimit) {$end = Navigation::addPeriod(clone $budgetLimit->startdate, $budgetLimit->repeat_freq, 0);$end->subDay();$set = $budgetLimit->limitrepetitions()->where('startdate', $budgetLimit->startdate->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))- ->get();+ ->get();if ($set->count() == 0) {$repetition = new LimitRepetition;$repetition->startdate = $budgetLimit->startdate;@@ -91,7 +91,7 @@ class EventServiceProvider extends ServiceProviderprotected function registerDeleteEvents(){TransactionJournal::deleted(- function (TransactionJournal $journal) {+ function(TransactionJournal $journal) {/** @var Transaction $transaction */foreach ($journal->transactions()->get() as $transaction) {@@ -100,7 +100,7 @@ class EventServiceProvider extends ServiceProvider});PiggyBank::deleting(- function (PiggyBank $piggyBank) {+ function(PiggyBank $piggyBank) {$reminders = $piggyBank->reminders()->get();/** @var Reminder $reminder */foreach ($reminders as $reminder) {@@ -110,7 +110,7 @@ class EventServiceProvider extends ServiceProvider);Account::deleted(- function (Account $account) {+ function(Account $account) {/** @var Transaction $transaction */foreach ($account->transactions()->get() as $transaction) {@@ -131,7 +131,7 @@ class EventServiceProvider extends ServiceProvider// move this routine to a filter// in case of repeated piggy banks and/or other problems.PiggyBank::created(- function (PiggyBank $piggyBank) {+ function(PiggyBank $piggyBank) {$repetition = new PiggyBankRepetition;$repetition->piggyBank()->associate($piggyBank);$repetition->startdate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate;diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.phpindex eff456ea08..ab5d1be9e5 100644--- a/app/Providers/FireflyServiceProvider.php+++ b/app/Providers/FireflyServiceProvider.php@@ -30,7 +30,7 @@ class FireflyServiceProvider extends ServiceProviderpublic function boot(){Validator::resolver(- function ($translator, $data, $rules, $messages) {+ function($translator, $data, $rules, $messages) {return new FireflyValidator($translator, $data, $rules, $messages);});@@ -55,28 +55,28 @@ class FireflyServiceProvider extends ServiceProvider$this->app->bind(- 'preferences', function () {+ 'preferences', function() {return new Preferences;});$this->app->bind(- 'navigation', function () {+ 'navigation', function() {return new Navigation;});$this->app->bind(- 'amount', function () {+ 'amount', function() {return new Amount;});$this->app->bind(- 'steam', function () {+ 'steam', function() {return new Steam;});$this->app->bind(- 'expandedform', function () {+ 'expandedform', function() {return new ExpandedForm;});diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.phpindex 4e40f5bec8..b95fa98635 100644--- a/app/Providers/RouteServiceProvider.php+++ b/app/Providers/RouteServiceProvider.php@@ -44,7 +44,7 @@ class RouteServiceProvider extends ServiceProviderpublic function map(Router $router){$router->group(- ['namespace' => $this->namespace], function ($router) {+ ['namespace' => $this->namespace], function($router) {/** @noinspection PhpIncludeInspection */require app_path('Http/routes.php');}diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.phpindex 0f03b71f3d..8cd51fd77a 100644--- a/app/Repositories/Account/AccountRepository.php+++ b/app/Repositories/Account/AccountRepository.php@@ -64,7 +64,7 @@ class AccountRepository implements AccountRepositoryInterfacepublic function getAccounts(array $types){$result = Auth::user()->accounts()->with(- ['accountmeta' => function (HasMany $query) {+ ['accountmeta' => function(HasMany $query) {$query->where('name', 'accountRole');}])->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*'])->sortBy('name');@@ -79,15 +79,15 @@ class AccountRepository implements AccountRepositoryInterfacepublic function getCreditCards(){return Auth::user()->accounts()- ->hasMetaValue('accountRole', 'ccAsset')- ->hasMetaValue('ccType', 'monthlyFull')- ->get(- [- 'accounts.*',- 'ccType.data as ccType',- 'accountRole.data as accountRole'- ]- );+ ->hasMetaValue('accountRole', 'ccAsset')+ ->hasMetaValue('ccType', 'monthlyFull')+ ->get(+ [+ 'accounts.*',+ 'ccType.data as ccType',+ 'accountRole.data as accountRole'+ ]+ );}/**@@ -132,18 +132,18 @@ class AccountRepository implements AccountRepositoryInterfacepublic function getFrontpageTransactions(Account $account, Carbon $start, Carbon $end){return Auth::user()- ->transactionjournals()- ->with(['transactions'])- ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')- ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->where('accounts.id', $account->id)- ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transaction_journals.transaction_currency_id')- ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')- ->before($end)- ->after($start)- ->orderBy('transaction_journals.date', 'DESC')- ->orderBy('transaction_journals.id', 'DESC')- ->take(10)- ->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);+ ->transactionjournals()+ ->with(['transactions'])+ ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')+ ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->where('accounts.id', $account->id)+ ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transaction_journals.transaction_currency_id')+ ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')+ ->before($end)+ ->after($start)+ ->orderBy('transaction_journals.date', 'DESC')+ ->orderBy('transaction_journals.id', 'DESC')+ ->take(10)+ ->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);}/**@@ -156,13 +156,13 @@ class AccountRepository implements AccountRepositoryInterface{$offset = ($page - 1) * 50;$query = Auth::user()- ->transactionJournals()- ->withRelevantData()- ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')- ->where('transactions.account_id', $account->id)- ->orderBy('transaction_journals.date', 'DESC')- ->orderBy('transaction_journals.order', 'ASC')- ->orderBy('transaction_journals.id', 'DESC');+ ->transactionJournals()+ ->withRelevantData()+ ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')+ ->where('transactions.account_id', $account->id)+ ->orderBy('transaction_journals.date', 'DESC')+ ->orderBy('transaction_journals.order', 'ASC')+ ->orderBy('transaction_journals.id', 'DESC');$count = $query->count();$set = $query->take(50)->offset($offset)->get(['transaction_journals.*']);@@ -213,7 +213,7 @@ class AccountRepository implements AccountRepositoryInterface}$accounts->each(- function (Account $account) use ($start, $end) {+ function(Account $account) use ($start, $end) {$account->startBalance = Steam::balance($account, $start, true);$account->endBalance = Steam::balance($account, $end, true);$account->piggyBalance = 0;@@ -251,7 +251,7 @@ class AccountRepository implements AccountRepositoryInterface$end = clone Session::get('end', new Carbon);$accounts->each(- function (Account $account) use ($start, $end) {+ function(Account $account) use ($start, $end) {$account->startBalance = Steam::balance($account, $start);$account->endBalance = Steam::balance($account, $end);@@ -289,22 +289,22 @@ class AccountRepository implements AccountRepositoryInterface*/public function getTransfersInRange(Account $account, Carbon $start, Carbon $end){- $set = TransactionJournal::whereIn(- 'id', function (Builder $q) use ($account, $start, $end) {+ $set = TransactionJournal::whereIn(+ 'id', function(Builder $q) use ($account, $start, $end) {$q->select('transaction_journals.id')- ->from('transactions')- ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')- ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')- ->where('transactions.account_id', $account->id)- ->where('transaction_journals.user_id', Auth::user()->id)- ->where('transaction_journals.date', '>=', $start->format('Y-m-d'))- ->where('transaction_journals.date', '<=', $end->format('Y-m-d'))- ->where('transaction_types.type', 'Transfer');+ ->from('transactions')+ ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')+ ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')+ ->where('transactions.account_id', $account->id)+ ->where('transaction_journals.user_id', Auth::user()->id)+ ->where('transaction_journals.date', '>=', $start->format('Y-m-d'))+ ->where('transaction_journals.date', '<=', $end->format('Y-m-d'))+ ->where('transaction_types.type', 'Transfer');})->get();$filtered = $set->filter(- function (TransactionJournal $journal) use ($account) {+ function(TransactionJournal $journal) use ($account) {if ($journal->destination_account->id == $account->id) {return $journal;}@@ -342,9 +342,9 @@ class AccountRepository implements AccountRepositoryInterfacepublic function openingBalanceTransaction(Account $account){return TransactionJournal::accountIs($account)- ->orderBy('transaction_journals.date', 'ASC')- ->orderBy('created_at', 'ASC')- ->first(['transaction_journals.*']);+ ->orderBy('transaction_journals.date', 'ASC')+ ->orderBy('created_at', 'ASC')+ ->first(['transaction_journals.*']);}/**@@ -368,7 +368,7 @@ class AccountRepository implements AccountRepositoryInterface'name' => $data['name'] . ' initial balance','active' => false,];- $opposing = $this->storeAccount($opposingData);+ $opposing = $this->storeAccount($opposingData);$this->storeInitialBalance($newAccount, $opposing, $data);}@@ -418,13 +418,13 @@ class AccountRepository implements AccountRepositoryInterface'name' => $data['name'] . ' initial balance','active' => false,];- $opposing = $this->storeAccount($opposingData);+ $opposing = $this->storeAccount($opposingData);$this->storeInitialBalance($account, $opposing, $data);}} else {if ($openingBalance) { // opening balance is zero, should we delete it?- $openingBalance->delete();// delete existing opening balance.+ $openingBalance->delete(); // delete existing opening balance.}}@@ -451,7 +451,7 @@ class AccountRepository implements AccountRepositoryInterfaceif (!$newAccount->isValid()) {// does the account already exist?- $searchData = [+ $searchData = ['user_id' => $data['user'],'account_type_id' => $accountType->id,'name' => $data['name']diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.phpindex 190808cfb0..c537027817 100644--- a/app/Repositories/Bill/BillRepository.php+++ b/app/Repositories/Bill/BillRepository.php@@ -25,7 +25,7 @@ class BillRepository implements BillRepositoryInterface* @param Carbon $start* @param Carbon $end*- * @return float+ * @return integer*/public function billPaymentsInRange(Bill $bill, Carbon $start, Carbon $end){@@ -67,7 +67,7 @@ class BillRepository implements BillRepositoryInterface/*** @param Bill $bill*- * @return mixed+ * @return boolean|null*/public function destroy(Bill $bill){@@ -258,7 +258,7 @@ class BillRepository implements BillRepositoryInterface* @param Bill $bill* @param TransactionJournal $journal*- * @return bool+ * @return boolean|null*/public function scan(Bill $bill, TransactionJournal $journal){@@ -331,7 +331,7 @@ class BillRepository implements BillRepositoryInterface* @param Bill $bill* @param array $data*- * @return Bill|static+ * @return Bill*/public function update(Bill $bill, array $data){diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.phpindex 8a13ce11df..efe12c2eab 100644--- a/app/Repositories/Budget/BudgetRepository.php+++ b/app/Repositories/Budget/BudgetRepository.php@@ -79,10 +79,10 @@ class BudgetRepository implements BudgetRepositoryInterface/** @var Collection $repetitions */return LimitRepetition::leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')- ->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'))- ->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'))- ->where('budget_limits.budget_id', $budget->id)- ->get(['limit_repetitions.*']);+ ->where('limit_repetitions.startdate', '<=', $end->format('Y-m-d 00:00:00'))+ ->where('limit_repetitions.startdate', '>=', $start->format('Y-m-d 00:00:00'))+ ->where('budget_limits.budget_id', $budget->id)+ ->get(['limit_repetitions.*']);}/**@@ -154,9 +154,9 @@ class BudgetRepository implements BudgetRepositoryInterface$setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)- ->orderBy('transaction_journals.date', 'DESC')- ->orderBy('transaction_journals.order', 'ASC')- ->orderBy('transaction_journals.id', 'DESC');+ ->orderBy('transaction_journals.date', 'DESC')+ ->orderBy('transaction_journals.order', 'ASC')+ ->orderBy('transaction_journals.id', 'DESC');$countQuery = $budget->transactionJournals();@@ -196,9 +196,9 @@ class BudgetRepository implements BudgetRepositoryInterfacepublic function getLimitAmountOnDate(Budget $budget, Carbon $date){$repetition = LimitRepetition::leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')- ->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))- ->where('budget_limits.budget_id', $budget->id)- ->first(['limit_repetitions.*']);+ ->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))+ ->where('budget_limits.budget_id', $budget->id)+ ->first(['limit_repetitions.*']);if ($repetition) {return floatval($repetition->amount);@@ -216,42 +216,42 @@ class BudgetRepository implements BudgetRepositoryInterfacepublic function getWithoutBudget(Carbon $start, Carbon $end){return Auth::user()- ->transactionjournals()- ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')- ->whereNull('budget_transaction_journal.id')- ->before($end)- ->after($start)- ->orderBy('transaction_journals.date', 'DESC')- ->orderBy('transaction_journals.order', 'ASC')- ->orderBy('transaction_journals.id', 'DESC')- ->get(['transaction_journals.*']);+ ->transactionjournals()+ ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')+ ->whereNull('budget_transaction_journal.id')+ ->before($end)+ ->after($start)+ ->orderBy('transaction_journals.date', 'DESC')+ ->orderBy('transaction_journals.order', 'ASC')+ ->orderBy('transaction_journals.id', 'DESC')+ ->get(['transaction_journals.*']);}/*** @param Carbon $start* @param Carbon $end*- * @return mixed+ * @return double*/public function getWithoutBudgetSum(Carbon $start, Carbon $end){$noBudgetSet = Auth::user()- ->transactionjournals()- ->whereNotIn(- 'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) {- $query- ->select('transaction_journals.id')- ->from('transaction_journals')- ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')- ->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00'))- ->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00'))- ->whereNotNull('budget_transaction_journal.budget_id');- }- )- ->after($start)- ->before($end)- ->transactionTypes(['Withdrawal'])- ->get(['transaction_journals.*'])->sum('amount');+ ->transactionjournals()+ ->whereNotIn(+ 'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) {+ $query+ ->select('transaction_journals.id')+ ->from('transaction_journals')+ ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')+ ->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00'))+ ->where('transaction_journals.date', '<=', $end->format('Y-m-d 00:00:00'))+ ->whereNotNull('budget_transaction_journal.budget_id');+ }+ )+ ->after($start)+ ->before($end)+ ->transactionTypes(['Withdrawal'])+ ->get(['transaction_journals.*'])->sum('amount');return floatval($noBudgetSet) * -1;}@@ -272,18 +272,18 @@ class BudgetRepository implements BudgetRepositoryInterface} else {// get all journals in this month where the asset account is NOT shared.$sum = $budget->transactionjournals()- ->before($end)- ->after($start)- ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')- ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')- ->leftJoin(- 'account_meta', function (JoinClause $join) {- $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');- }- )- ->where('account_meta.data', '!=', '"sharedAsset"')- ->get(['transaction_journals.*'])- ->sum('amount');+ ->before($end)+ ->after($start)+ ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')+ ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')+ ->leftJoin(+ 'account_meta', function (JoinClause $join) {+ $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');+ }+ )+ ->where('account_meta.data', '!=', '"sharedAsset"')+ ->get(['transaction_journals.*'])+ ->sum('amount');$sum = floatval($sum);}@@ -330,7 +330,7 @@ class BudgetRepository implements BudgetRepositoryInterface* @param Carbon $date* @param $amount*- * @return LimitRepetition|null+ * @return BudgetLimit*/public function updateLimitAmount(Budget $budget, Carbon $date, $amount){diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.phpindex 1fbb964e42..5bf3dfd1b1 100644--- a/app/Repositories/Category/CategoryRepository.php+++ b/app/Repositories/Category/CategoryRepository.php@@ -49,7 +49,7 @@ class CategoryRepository implements CategoryRepositoryInterface/** @var Collection $set */$set = Auth::user()->categories()->orderBy('name', 'ASC')->get();$set->sortBy(- function (Category $category) {+ function(Category $category) {return $category->name;});@@ -67,16 +67,16 @@ class CategoryRepository implements CategoryRepositoryInterfacepublic function getCategoriesAndExpensesCorrected($start, $end){$set = Auth::user()->transactionjournals()- ->leftJoin(- 'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'- )- ->leftJoin('categories', 'categories.id', '=', 'category_transaction_journal.category_id')- ->before($end)- ->where('categories.user_id', Auth::user()->id)- ->after($start)- ->transactionTypes(['Withdrawal'])- ->groupBy('categories.id')- ->get(['categories.id as category_id', 'categories.encrypted as category_encrypted', 'categories.name', 'transaction_journals.*']);+ ->leftJoin(+ 'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'+ )+ ->leftJoin('categories', 'categories.id', '=', 'category_transaction_journal.category_id')+ ->before($end)+ ->where('categories.user_id', Auth::user()->id)+ ->after($start)+ ->transactionTypes(['Withdrawal'])+ ->groupBy('categories.id')+ ->get(['categories.id as category_id', 'categories.encrypted as category_encrypted', 'categories.name', 'transaction_journals.*']);$result = [];foreach ($set as $entry) {@@ -143,10 +143,10 @@ class CategoryRepository implements CategoryRepositoryInterfacepublic function getLatestActivity(Category $category){$latest = $category->transactionjournals()- ->orderBy('transaction_journals.date', 'DESC')- ->orderBy('transaction_journals.order', 'ASC')- ->orderBy('transaction_journals.id', 'DESC')- ->first();+ ->orderBy('transaction_journals.date', 'DESC')+ ->orderBy('transaction_journals.order', 'ASC')+ ->orderBy('transaction_journals.id', 'DESC')+ ->first();if ($latest) {return $latest->date;}@@ -163,15 +163,15 @@ class CategoryRepository implements CategoryRepositoryInterfacepublic function getWithoutCategory(Carbon $start, Carbon $end){return Auth::user()- ->transactionjournals()- ->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')- ->whereNull('category_transaction_journal.id')- ->before($end)- ->after($start)- ->orderBy('transaction_journals.date', 'DESC')- ->orderBy('transaction_journals.order', 'ASC')- ->orderBy('transaction_journals.id', 'DESC')- ->get(['transaction_journals.*']);+ ->transactionjournals()+ ->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')+ ->whereNull('category_transaction_journal.id')+ ->before($end)+ ->after($start)+ ->orderBy('transaction_journals.date', 'DESC')+ ->orderBy('transaction_journals.order', 'ASC')+ ->orderBy('transaction_journals.id', 'DESC')+ ->get(['transaction_journals.*']);}/**@@ -190,8 +190,8 @@ class CategoryRepository implements CategoryRepositoryInterface// always ignore transfers between accounts!$sum = floatval($category->transactionjournals()- ->transactionTypes(['Withdrawal'])- ->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount')+ ->transactionTypes(['Withdrawal'])+ ->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount'));} else {@@ -204,7 +204,7 @@ class CategoryRepository implements CategoryRepositoryInterface->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->leftJoin(- 'account_meta', function (JoinClause $join) {+ 'account_meta', function(JoinClause $join) {$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');})diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.phpindex cdc0775a46..a7fb12f50a 100644--- a/app/Repositories/Journal/JournalRepository.php+++ b/app/Repositories/Journal/JournalRepository.php@@ -29,7 +29,7 @@ class JournalRepository implements JournalRepositoryInterface/*** @param int $reminderId*- * @return bool+ * @return boolean|null*/public function deactivateReminder($reminderId){@@ -72,7 +72,7 @@ class JournalRepository implements JournalRepositoryInterface* @param TransactionJournal $journal* @param Transaction $transaction*- * @return float+ * @return integer*/public function getAmountBefore(TransactionJournal $journal, Transaction $transaction){@@ -111,7 +111,7 @@ class JournalRepository implements JournalRepositoryInterface*/public function getJournalsOfTypes(array $types, $offset, $page){- $set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take(50)->offset($offset)+ $set = Auth::user()->transactionJournals()->transactionTypes($types)->withRelevantData()->take(50)->offset($offset)->orderBy('date', 'DESC')->orderBy('order', 'ASC')->orderBy('id', 'DESC')@@ -240,7 +240,7 @@ class JournalRepository implements JournalRepositoryInterface* @param TransactionJournal $journal* @param array $data*- * @return mixed+ * @return TransactionJournal*/public function update(TransactionJournal $journal, array $data){diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.phpindex 1cb61bedee..3db4693284 100644--- a/app/Repositories/PiggyBank/PiggyBankRepository.php+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php@@ -33,7 +33,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface/*** @param PiggyBank $piggyBank*- * @return bool+ * @return boolean|null*/public function destroy(PiggyBank $piggyBank){@@ -102,7 +102,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterfacepublic function setOrder($id, $order){$piggyBank = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('accounts.user_id', Auth::user()->id)- ->where('piggy_banks.id', $id)->first(['piggy_banks.*']);+ ->where('piggy_banks.id', $id)->first(['piggy_banks.*']);if ($piggyBank) {$piggyBank->order = $order;$piggyBank->save();diff --git a/app/Repositories/Reminder/ReminderRepository.php b/app/Repositories/Reminder/ReminderRepository.phpindex 8db6d0ada0..ae04c59c66 100644--- a/app/Repositories/Reminder/ReminderRepository.php+++ b/app/Repositories/Reminder/ReminderRepository.php@@ -36,14 +36,14 @@ class ReminderRepository implements ReminderRepositoryInterface$today = new Carbon;// active reminders:$active = Auth::user()->reminders()- ->where('notnow', 0)- ->where('active', 1)- ->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))- ->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))- ->get();+ ->where('notnow', 0)+ ->where('active', 1)+ ->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))+ ->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))+ ->get();$active->each(- function (Reminder $reminder) {+ function(Reminder $reminder) {$reminder->description = $this->helper->getReminderText($reminder);});@@ -58,11 +58,11 @@ class ReminderRepository implements ReminderRepositoryInterfacepublic function getDismissedReminders(){$dismissed = Auth::user()->reminders()- ->where('notnow', 1)- ->get();+ ->where('notnow', 1)+ ->get();$dismissed->each(- function (Reminder $reminder) {+ function(Reminder $reminder) {$reminder->description = $this->helper->getReminderText($reminder);});@@ -77,18 +77,18 @@ class ReminderRepository implements ReminderRepositoryInterface{$expired = Auth::user()->reminders()- ->where('notnow', 0)- ->where('active', 1)- ->where(- function (Builder $q) {- $today = new Carbon;- $q->where('startdate', '>', $today->format('Y-m-d 00:00:00'));- $q->orWhere('enddate', '<', $today->format('Y-m-d 00:00:00'));- }- )->get();+ ->where('notnow', 0)+ ->where('active', 1)+ ->where(+ function (Builder $q) {+ $today = new Carbon;+ $q->where('startdate', '>', $today->format('Y-m-d 00:00:00'));+ $q->orWhere('enddate', '<', $today->format('Y-m-d 00:00:00'));+ }+ )->get();$expired->each(- function (Reminder $reminder) {+ function(Reminder $reminder) {$reminder->description = $this->helper->getReminderText($reminder);});@@ -106,7 +106,7 @@ class ReminderRepository implements ReminderRepositoryInterface->get();$inactive->each(- function (Reminder $reminder) {+ function(Reminder $reminder) {$reminder->description = $this->helper->getReminderText($reminder);});diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.phpindex 77b551cc54..c18efc01af 100644--- a/app/Repositories/Tag/TagRepository.php+++ b/app/Repositories/Tag/TagRepository.php@@ -64,7 +64,7 @@ class TagRepository implements TagRepositoryInterface* @param Carbon $start* @param Carbon $end*- * @return float+ * @return integer*/public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end){@@ -109,7 +109,7 @@ class TagRepository implements TagRepositoryInterface/** @var Collection $tags */$tags = Auth::user()->tags()->get();$tags->sortBy(- function (Tag $tag) {+ function(Tag $tag) {return $tag->tag;});diff --git a/app/Services/Registrar.php b/app/Services/Registrar.phpindex 5f69c7ba24..6f9ffa729a 100644--- a/app/Services/Registrar.php+++ b/app/Services/Registrar.php@@ -41,9 +41,9 @@ class Registrar implements RegistrarContract{return Validator::make($data, [- 'email' => 'required|email|max:255|unique:users',- 'password' => 'required|confirmed|min:6',- ]+ 'email' => 'required|email|max:255|unique:users',+ 'password' => 'required|confirmed|min:6',+ ]);}diff --git a/app/Support/Navigation.php b/app/Support/Navigation.phpindex 542cd669f3..f2dd884673 100644--- a/app/Support/Navigation.php+++ b/app/Support/Navigation.php@@ -118,7 +118,7 @@ class Navigation'year' => 'endOfYear','yearly' => 'endOfYear',];- $specials = ['mont', 'monthly'];+ $specials = ['mont', 'monthly'];$currentEnd = clone $theCurrentEnd;@@ -270,7 +270,7 @@ class Navigation'3M' => 'lastOfQuarter','1Y' => 'endOfYear',];- $end = clone $start;+ $end = clone $start;if (isset($functionMap[$range])) {$function = $functionMap[$range];diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.phpindex a493ad0741..7b1e0f42b5 100644--- a/app/Support/Search/Search.php+++ b/app/Support/Search/Search.php@@ -25,7 +25,7 @@ class Search implements SearchInterfacepublic function searchAccounts(array $words){return Auth::user()->accounts()->with('accounttype')->where(- function (EloquentBuilder $q) use ($words) {+ function(EloquentBuilder $q) use ($words) {foreach ($words as $word) {$q->orWhere('name', 'LIKE', '%' . e($word) . '%');}@@ -43,7 +43,7 @@ class Search implements SearchInterface/** @var Collection $set */$set = Auth::user()->budgets()->get();$newSet = $set->filter(- function (Budget $b) use ($words) {+ function(Budget $b) use ($words) {$found = 0;foreach ($words as $word) {if (!(strpos(strtolower($b->name), strtolower($word)) === false)) {@@ -68,7 +68,7 @@ class Search implements SearchInterface/** @var Collection $set */$set = Auth::user()->categories()->get();$newSet = $set->filter(- function (Category $c) use ($words) {+ function(Category $c) use ($words) {$found = 0;foreach ($words as $word) {if (!(strpos(strtolower($c->name), strtolower($word)) === false)) {@@ -103,7 +103,7 @@ class Search implements SearchInterface{// decrypted transaction journals:$decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where(- function (EloquentBuilder $q) use ($words) {+ function(EloquentBuilder $q) use ($words) {foreach ($words as $word) {$q->orWhere('description', 'LIKE', '%' . e($word) . '%');}@@ -113,7 +113,7 @@ class Search implements SearchInterface// encrypted$all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get();$set = $all->filter(- function (TransactionJournal $journal) use ($words) {+ function(TransactionJournal $journal) use ($words) {foreach ($words as $word) {$haystack = strtolower($journal->description);$word = strtolower($word);@@ -129,7 +129,7 @@ class Search implements SearchInterface$filtered = $set->merge($decrypted);$filtered->sortBy(- function (TransactionJournal $journal) {+ function(TransactionJournal $journal) {return intval($journal->date->format('U'));});diff --git a/app/Support/Twig/Budget.php b/app/Support/Twig/Budget.phpindex 874ca15424..2424f8b0c8 100644--- a/app/Support/Twig/Budget.php+++ b/app/Support/Twig/Budget.php@@ -21,16 +21,16 @@ class Budget extends Twig_Extension{$functions = [];$functions[] = new Twig_SimpleFunction(- 'spentInRepetitionCorrected', function (LimitRepetition $repetition) {+ 'spentInRepetitionCorrected', function(LimitRepetition $repetition) {$sum= Auth::user()->transactionjournals()- ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')- ->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')- ->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')- ->before($repetition->enddate)- ->after($repetition->startdate)- ->where('limit_repetitions.id', '=', $repetition->id)- ->get(['transaction_journals.*'])->sum('amount');+ ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')+ ->leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')+ ->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')+ ->before($repetition->enddate)+ ->after($repetition->startdate)+ ->where('limit_repetitions.id', '=', $repetition->id)+ ->get(['transaction_journals.*'])->sum('amount');return floatval($sum);}diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.phpindex c1bcf09e16..81ea504928 100644--- a/app/Support/Twig/General.php+++ b/app/Support/Twig/General.php@@ -31,31 +31,31 @@ class General extends Twig_Extension$filters = [];$filters[] = new Twig_SimpleFilter(- 'formatAmount', function ($string) {+ 'formatAmount', function($string) {return App::make('amount')->format($string);}, ['is_safe' => ['html']]);$filters[] = new Twig_SimpleFilter(- 'formatTransaction', function (Transaction $transaction) {+ 'formatTransaction', function(Transaction $transaction) {return App::make('amount')->formatTransaction($transaction);}, ['is_safe' => ['html']]);$filters[] = new Twig_SimpleFilter(- 'formatAmountPlain', function ($string) {+ 'formatAmountPlain', function($string) {return App::make('amount')->format($string, false);}, ['is_safe' => ['html']]);$filters[] = new Twig_SimpleFilter(- 'formatJournal', function ($journal) {+ 'formatJournal', function($journal) {return App::make('amount')->formatJournal($journal);}, ['is_safe' => ['html']]);$filters[] = new Twig_SimpleFilter(- 'balance', function (Account $account = null) {+ 'balance', function(Account $account = null) {if (is_null($account)) {return 'NULL';}@@ -67,7 +67,7 @@ class General extends Twig_Extension// should be a function but OK$filters[] = new Twig_SimpleFilter(- 'getAccountRole', function ($name) {+ 'getAccountRole', function($name) {return Config::get('firefly.accountRoles.' . $name);});@@ -83,32 +83,32 @@ class General extends Twig_Extension$functions = [];$functions[] = new Twig_SimpleFunction(- 'getCurrencyCode', function () {+ 'getCurrencyCode', function() {return App::make('amount')->getCurrencyCode();});$functions[] = new Twig_SimpleFunction(- 'getCurrencySymbol', function () {+ 'getCurrencySymbol', function() {return App::make('amount')->getCurrencySymbol();});$functions[] = new Twig_SimpleFunction(- 'phpdate', function ($str) {+ 'phpdate', function($str) {return date($str);});$functions[] = new Twig_SimpleFunction(- 'env', function ($name, $default) {+ 'env', function($name, $default) {return env($name, $default);});$functions[] = new Twig_SimpleFunction(- 'activeRoute', function ($context) {+ 'activeRoute', function($context) {$args = func_get_args();$route = $args[1];$what = isset($args[2]) ? $args[2] : false;diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.phpindex 60b4e34ec2..beaafae668 100644--- a/app/Support/Twig/Journal.php+++ b/app/Support/Twig/Journal.php@@ -26,7 +26,7 @@ class Journal extends Twig_Extension$filters = [];$filters[] = new Twig_SimpleFilter(- 'typeIcon', function (TransactionJournal $journal) {+ 'typeIcon', function(TransactionJournal $journal) {$type = $journal->transactionType->type;switch ($type) {@@ -59,7 +59,7 @@ class Journal extends Twig_Extension$functions = [];$functions[] = new Twig_SimpleFunction(- 'invalidJournal', function (TransactionJournal $journal) {+ 'invalidJournal', function(TransactionJournal $journal) {if (!isset($journal->transactions[1]) || !isset($journal->transactions[0])) {return true;}@@ -69,7 +69,7 @@ class Journal extends Twig_Extension);$functions[] = new Twig_SimpleFunction(- 'relevantTags', function (TransactionJournal $journal) {+ 'relevantTags', function(TransactionJournal $journal) {if ($journal->tags->count() == 0) {return App::make('amount')->formatJournal($journal);}@@ -82,7 +82,7 @@ class Journal extends Twig_Extension$amount = App::make('amount')->format($journal->actual_amount, false);return '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount- . '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';+ . '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';}/*@@ -92,7 +92,7 @@ class Journal extends Twig_Extension$amount = App::make('amount')->formatJournal($journal, false);return '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount- . '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';+ . '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';}/** AdvancePayment with a withdrawal will show the amount with a link todiff --git a/app/Support/Twig/PiggyBank.php b/app/Support/Twig/PiggyBank.phpindex 6ff4aafe90..f178aa6316 100644--- a/app/Support/Twig/PiggyBank.php+++ b/app/Support/Twig/PiggyBank.php@@ -22,7 +22,7 @@ class PiggyBank extends Twig_Extension$functions = [];$functions[] = new Twig_SimpleFunction(- 'currentRelevantRepAmount', function (PB $piggyBank) {+ 'currentRelevantRepAmount', function(PB $piggyBank) {return $piggyBank->currentRelevantRep()->currentamount;});diff --git a/app/Support/Twig/Translation.php b/app/Support/Twig/Translation.phpindex 1cb3314cf2..d91c1816e6 100644--- a/app/Support/Twig/Translation.php+++ b/app/Support/Twig/Translation.php@@ -21,7 +21,7 @@ class Translation extends Twig_Extension$filters = [];$filters[] = new Twig_SimpleFilter(- '_', function ($name) {+ '_', function($name) {return trans('firefly.' . $name);