mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Code cleanup [skip ci]
This commit is contained in:
@@ -64,6 +64,7 @@ class BalanceLine
|
||||
if ($this->getRole() == self::ROLE_DIFFROLE) {
|
||||
return trans('firefly.leftUnbalanced');
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ class Bill
|
||||
public function getBills()
|
||||
{
|
||||
$this->bills->sortBy(
|
||||
function(BillLine $bill) {
|
||||
function (BillLine $bill) {
|
||||
$active = intval($bill->getBill()->active) == 0 ? 1 : 0;
|
||||
$name = $bill->getBill()->name;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ class Category
|
||||
public function getCategories()
|
||||
{
|
||||
$this->categories->sortByDesc(
|
||||
function(CategoryModel $category) {
|
||||
function (CategoryModel $category) {
|
||||
return $category->spent;
|
||||
}
|
||||
);
|
||||
|
@@ -67,7 +67,7 @@ class Expense
|
||||
public function getExpenses()
|
||||
{
|
||||
$this->expenses->sortByDesc(
|
||||
function(stdClass $object) {
|
||||
function (stdClass $object) {
|
||||
return $object->amount;
|
||||
}
|
||||
);
|
||||
|
@@ -68,7 +68,7 @@ class Income
|
||||
public function getIncomes()
|
||||
{
|
||||
$this->incomes->sortByDesc(
|
||||
function(stdClass $object) {
|
||||
function (stdClass $object) {
|
||||
return $object->amount;
|
||||
}
|
||||
);
|
||||
|
@@ -66,10 +66,11 @@ class ReportHelper implements ReportHelperInterface
|
||||
|
||||
// remove cash account, if any:
|
||||
$accounts = $accounts->filter(
|
||||
function(Account $account) {
|
||||
function (Account $account) {
|
||||
if ($account->accountType->type != 'Cash account') {
|
||||
return $account;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
@@ -5,9 +5,9 @@ namespace FireflyIII\Helpers\Report;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Collection\Account as AccountCollection;
|
||||
use FireflyIII\Helpers\Collection\Balance;
|
||||
use FireflyIII\Helpers\Collection\Bill as BillCollection;
|
||||
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
|
||||
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
|
||||
use FireflyIII\Helpers\Collection\Bill as BillCollection;
|
||||
use FireflyIII\Helpers\Collection\Expense;
|
||||
use FireflyIII\Helpers\Collection\Income;
|
||||
|
||||
|
@@ -35,15 +35,15 @@ class ReportQuery implements ReportQueryInterface
|
||||
$query = $this->queryJournalsWithTransactions($start, $end);
|
||||
if ($includeShared === false) {
|
||||
$query->where(
|
||||
function(Builder $query) {
|
||||
function (Builder $query) {
|
||||
$query->where(
|
||||
function(Builder $q) { // only get withdrawals not from a shared account
|
||||
function (Builder $q) { // only get withdrawals not from a shared account
|
||||
$q->where('transaction_types.type', 'Withdrawal');
|
||||
$q->where('acm_from.data', '!=', '"sharedAsset"');
|
||||
}
|
||||
);
|
||||
$query->orWhere(
|
||||
function(Builder $q) { // and transfers from a shared account.
|
||||
function (Builder $q) { // and transfers from a shared account.
|
||||
$q->where('transaction_types.type', 'Transfer');
|
||||
$q->where('acm_to.data', '=', '"sharedAsset"');
|
||||
}
|
||||
@@ -61,17 +61,18 @@ class ReportQuery implements ReportQueryInterface
|
||||
);
|
||||
|
||||
$data->each(
|
||||
function(TransactionJournal $journal) {
|
||||
function (TransactionJournal $journal) {
|
||||
if (intval($journal->account_encrypted) == 1) {
|
||||
$journal->name = Crypt::decrypt($journal->name);
|
||||
}
|
||||
}
|
||||
);
|
||||
$data = $data->filter(
|
||||
function(TransactionJournal $journal) {
|
||||
function (TransactionJournal $journal) {
|
||||
if ($journal->amount != 0) {
|
||||
return $journal;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
);
|
||||
@@ -94,13 +95,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');
|
||||
@@ -110,7 +111,7 @@ class ReportQuery implements ReportQueryInterface
|
||||
}
|
||||
$set = $query->get(['accounts.*']);
|
||||
$set->each(
|
||||
function(Account $account) use ($start, $end) {
|
||||
function (Account $account) use ($start, $end) {
|
||||
/**
|
||||
* The balance for today always incorporates transactions
|
||||
* made on today. So to get todays "start" balance, we sub one
|
||||
@@ -151,15 +152,15 @@ class ReportQuery implements ReportQueryInterface
|
||||
// only get deposits not to a shared account
|
||||
// and transfers to a shared account.
|
||||
$query->where(
|
||||
function(Builder $query) {
|
||||
function (Builder $query) {
|
||||
$query->where(
|
||||
function(Builder $q) {
|
||||
function (Builder $q) {
|
||||
$q->where('transaction_types.type', 'Deposit');
|
||||
$q->where('acm_to.data', '!=', '"sharedAsset"');
|
||||
}
|
||||
);
|
||||
$query->orWhere(
|
||||
function(Builder $q) {
|
||||
function (Builder $q) {
|
||||
$q->where('transaction_types.type', 'Transfer');
|
||||
$q->where('acm_from.data', '=', '"sharedAsset"');
|
||||
}
|
||||
@@ -178,17 +179,18 @@ class ReportQuery implements ReportQueryInterface
|
||||
);
|
||||
|
||||
$data->each(
|
||||
function(TransactionJournal $journal) {
|
||||
function (TransactionJournal $journal) {
|
||||
if (intval($journal->account_encrypted) == 1) {
|
||||
$journal->name = Crypt::decrypt($journal->name);
|
||||
}
|
||||
}
|
||||
);
|
||||
$data = $data->filter(
|
||||
function(TransactionJournal $journal) {
|
||||
function (TransactionJournal $journal) {
|
||||
if ($journal->amount != 0) {
|
||||
return $journal;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
);
|
||||
@@ -254,24 +256,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');
|
||||
}
|
||||
)
|
||||
|
@@ -7,12 +7,13 @@ use FireflyIII\Http\Requests\AccountFormRequest;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Input;
|
||||
use Preferences;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use Steam;
|
||||
use URL;
|
||||
use View;
|
||||
use Preferences;
|
||||
|
||||
/**
|
||||
* Class AccountController
|
||||
*
|
||||
@@ -155,7 +156,7 @@ class AccountController extends Controller
|
||||
$start = clone Session::get('start', Carbon::now()->startOfMonth());
|
||||
$start->subDay();
|
||||
$accounts->each(
|
||||
function(Account $account) use ($start, $repository) {
|
||||
function (Account $account) use ($start, $repository) {
|
||||
$account->lastActivityDate = $repository->getLastActivity($account);
|
||||
$account->startBalance = Steam::balance($account, $start);
|
||||
$account->endBalance = Steam::balance($account, clone Session::get('end', Carbon::now()->endOfMonth()));
|
||||
@@ -200,7 +201,7 @@ class AccountController extends Controller
|
||||
'user' => Auth::user()->id,
|
||||
'accountRole' => $request->input('accountRole'),
|
||||
'openingBalance' => floatval($request->input('openingBalance')),
|
||||
'openingBalanceDate' => new Carbon((string) $request->input('openingBalanceDate')),
|
||||
'openingBalanceDate' => new Carbon((string)$request->input('openingBalanceDate')),
|
||||
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
|
||||
|
||||
];
|
||||
@@ -239,7 +240,7 @@ class AccountController extends Controller
|
||||
'accountRole' => $request->input('accountRole'),
|
||||
'virtualBalance' => floatval($request->input('virtualBalance')),
|
||||
'openingBalance' => floatval($request->input('openingBalance')),
|
||||
'openingBalanceDate' => new Carbon((string) $request->input('openingBalanceDate')),
|
||||
'openingBalanceDate' => new Carbon((string)$request->input('openingBalanceDate')),
|
||||
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
|
||||
'ccType' => $request->input('ccType'),
|
||||
'ccMonthlyPaymentDate' => $request->input('ccMonthlyPaymentDate'),
|
||||
|
@@ -109,7 +109,7 @@ class AuthController extends Controller
|
||||
if (User::count() == 1) {
|
||||
$admin = Role::where('name', 'owner')->first();
|
||||
$this->auth->user()->attachRole($admin);
|
||||
// $this->auth->user()->roles()->save($admin);
|
||||
// $this->auth->user()->roles()->save($admin);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -112,7 +112,7 @@ class BillController extends Controller
|
||||
{
|
||||
$bills = $repository->getBills();
|
||||
$bills->each(
|
||||
function(Bill $bill) use ($repository) {
|
||||
function (Bill $bill) use ($repository) {
|
||||
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill);
|
||||
$bill->lastFoundMatch = $repository->lastFoundMatch($bill);
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ class CategoryController extends Controller
|
||||
$categories = $repository->getCategories();
|
||||
|
||||
$categories->each(
|
||||
function(Category $category) use ($repository) {
|
||||
function (Category $category) use ($repository) {
|
||||
$category->lastActivity = $repository->getLatestActivity($category);
|
||||
}
|
||||
);
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Account;
|
||||
@@ -11,7 +9,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Grumpydictator\Gchart\GChart;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Response;
|
||||
use Session;
|
||||
@@ -43,15 +40,14 @@ class AccountController extends Controller
|
||||
$end->endOfMonth();
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties();
|
||||
$chartProperties->addProperty($start);
|
||||
$chartProperties->addProperty($end);
|
||||
$chartProperties->addProperty('all');
|
||||
$chartProperties->addProperty('accounts');
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('all');
|
||||
$cache->addProperty('accounts');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
|
||||
$chart->addColumn(trans('firefly.dayOfMonth'), 'date');
|
||||
@@ -91,7 +87,7 @@ class AccountController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
@@ -114,15 +110,14 @@ class AccountController extends Controller
|
||||
$accounts = $repository->getFrontpageAccounts($frontPage);
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties();
|
||||
$chartProperties->addProperty($start);
|
||||
$chartProperties->addProperty($end);
|
||||
$chartProperties->addProperty('frontpage');
|
||||
$chartProperties->addProperty('accounts');
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('frontpage');
|
||||
$cache->addProperty('accounts');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
|
||||
$index = 1;
|
||||
@@ -148,7 +143,7 @@ class AccountController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
|
||||
@@ -174,18 +169,15 @@ class AccountController extends Controller
|
||||
$today = new Carbon;
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties();
|
||||
$chartProperties->addProperty($start);
|
||||
$chartProperties->addProperty($end);
|
||||
$chartProperties->addProperty('frontpage');
|
||||
$chartProperties->addProperty('single');
|
||||
$chartProperties->addProperty($account->id);
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('frontpage');
|
||||
$cache->addProperty('single');
|
||||
$cache->addProperty($account->id);
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
|
||||
|
||||
while ($end >= $current) {
|
||||
$certain = $current < $today;
|
||||
@@ -197,7 +189,7 @@ class AccountController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
|
@@ -14,8 +14,7 @@ use Illuminate\Support\Collection;
|
||||
use Response;
|
||||
use Session;
|
||||
use Steam;
|
||||
use Cache;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class BillController
|
||||
*
|
||||
@@ -40,14 +39,13 @@ class BillController extends Controller
|
||||
$chart->addColumn(trans('firefly.minAmount'), 'number');
|
||||
$chart->addColumn(trans('firefly.billEntry'), 'number');
|
||||
|
||||
$chartProperties = new CacheProperties;
|
||||
$chartProperties->addProperty('single');
|
||||
$chartProperties->addProperty('bill');
|
||||
$chartProperties->addProperty($bill->id);
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty('single');
|
||||
$cache->addProperty('bill');
|
||||
$cache->addProperty($bill->id);
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
// get first transaction or today for start:
|
||||
$results = $repository->getJournals($bill);
|
||||
@@ -59,7 +57,7 @@ class BillController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
@@ -84,15 +82,14 @@ class BillController extends Controller
|
||||
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties();
|
||||
$chartProperties->addProperty($start);
|
||||
$chartProperties->addProperty($end);
|
||||
$chartProperties->addProperty('bills');
|
||||
$chartProperties->addProperty('frontpage');
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('bills');
|
||||
$cache->addProperty('frontpage');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
$bills = $repository->getActiveBills();
|
||||
$paid = new Collection; // journals.
|
||||
@@ -163,7 +160,7 @@ class BillController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Budget;
|
||||
@@ -11,7 +10,6 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Grumpydictator\Gchart\GChart;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Navigation;
|
||||
use Preferences;
|
||||
use Response;
|
||||
@@ -45,15 +43,14 @@ class BudgetController extends Controller
|
||||
$last = Navigation::endOfX($last, $range, $final);
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties();
|
||||
$chartProperties->addProperty($first);
|
||||
$chartProperties->addProperty($last);
|
||||
$chartProperties->addProperty('budget');
|
||||
$chartProperties->addProperty('budget');
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($first);
|
||||
$cache->addProperty($last);
|
||||
$cache->addProperty('budget');
|
||||
$cache->addProperty('budget');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
|
||||
while ($first < $last) {
|
||||
@@ -69,7 +66,7 @@ class BudgetController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
@@ -90,17 +87,16 @@ class BudgetController extends Controller
|
||||
$end = $repetition->enddate;
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties();
|
||||
$chartProperties->addProperty($start);
|
||||
$chartProperties->addProperty($end);
|
||||
$chartProperties->addProperty('budget');
|
||||
$chartProperties->addProperty('limit');
|
||||
$chartProperties->addProperty($budget->id);
|
||||
$chartProperties->addProperty($repetition->id);
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('budget');
|
||||
$cache->addProperty('limit');
|
||||
$cache->addProperty($budget->id);
|
||||
$cache->addProperty($repetition->id);
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
$chart->addColumn(trans('firefly.day'), 'date');
|
||||
$chart->addColumn(trans('firefly.left'), 'number');
|
||||
@@ -120,7 +116,7 @@ class BudgetController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
|
||||
@@ -147,15 +143,14 @@ class BudgetController extends Controller
|
||||
$allEntries = new Collection;
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties();
|
||||
$chartProperties->addProperty($start);
|
||||
$chartProperties->addProperty($end);
|
||||
$chartProperties->addProperty('budget');
|
||||
$chartProperties->addProperty('all');
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('budget');
|
||||
$cache->addProperty('all');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
|
||||
/** @var Budget $budget */
|
||||
@@ -194,7 +189,7 @@ class BudgetController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
|
||||
@@ -218,15 +213,14 @@ class BudgetController extends Controller
|
||||
$budgets = $repository->getBudgets();
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties();
|
||||
$chartProperties->addProperty($start);
|
||||
$chartProperties->addProperty($end);
|
||||
$chartProperties->addProperty('budget');
|
||||
$chartProperties->addProperty('year');
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('budget');
|
||||
$cache->addProperty('year');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
// add columns:
|
||||
$chart->addColumn(trans('firefly.month'), 'date');
|
||||
@@ -254,7 +248,7 @@ class BudgetController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
|
@@ -3,14 +3,12 @@
|
||||
namespace FireflyIII\Http\Controllers\Chart;
|
||||
|
||||
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Grumpydictator\Gchart\GChart;
|
||||
use Log;
|
||||
use Navigation;
|
||||
use Preferences;
|
||||
use Response;
|
||||
@@ -80,22 +78,21 @@ class CategoryController extends Controller
|
||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||
|
||||
// chart properties for cache:
|
||||
$chartProperties = new CacheProperties;
|
||||
$chartProperties->addProperty($start);
|
||||
$chartProperties->addProperty($end);
|
||||
$chartProperties->addProperty('category');
|
||||
$chartProperties->addProperty('frontpage');
|
||||
if ($chartProperties->has()) {
|
||||
return Response::json($chartProperties->get());
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('category');
|
||||
$cache->addProperty('frontpage');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $chartProperties->getMd5();
|
||||
|
||||
$set = $repository->getCategoriesAndExpensesCorrected($start, $end);
|
||||
|
||||
// sort by callback:
|
||||
uasort(
|
||||
$set,
|
||||
function($left, $right) {
|
||||
function ($left, $right) {
|
||||
if ($left['sum'] == $right['sum']) {
|
||||
return 0;
|
||||
}
|
||||
@@ -115,7 +112,7 @@ class CategoryController extends Controller
|
||||
$chart->generate();
|
||||
|
||||
$data = $chart->getData();
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Input;
|
||||
use Preferences;
|
||||
@@ -74,7 +73,6 @@ class HomeController extends Controller
|
||||
$piggyBankAccounts = $repository->getPiggyBankAccounts();
|
||||
|
||||
|
||||
|
||||
$savingsTotal = 0;
|
||||
foreach ($savings as $savingAccount) {
|
||||
$savingsTotal += Steam::balance($savingAccount, $end);
|
||||
@@ -95,6 +93,7 @@ class HomeController extends Controller
|
||||
$transactions[] = [$set, $account];
|
||||
}
|
||||
}
|
||||
|
||||
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts'));
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Amount;
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Report\ReportQueryInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
@@ -39,14 +38,13 @@ class JsonController extends Controller
|
||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||
|
||||
// works for json too!
|
||||
$prop = new CacheProperties;
|
||||
$prop->addProperty($start);
|
||||
$prop->addProperty($end);
|
||||
$prop->addProperty('box-bills-paid');
|
||||
if ($prop->has()) {
|
||||
return Response::json($prop->get());
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('box-bills-paid');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $prop->getMd5();
|
||||
|
||||
$amount = 0;
|
||||
|
||||
@@ -75,7 +73,8 @@ class JsonController extends Controller
|
||||
}
|
||||
}
|
||||
$data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
@@ -93,14 +92,13 @@ class JsonController extends Controller
|
||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||
|
||||
// works for json too!
|
||||
$prop = new CacheProperties;
|
||||
$prop->addProperty($start);
|
||||
$prop->addProperty($end);
|
||||
$prop->addProperty('box-bills-unpaid');
|
||||
if ($prop->has()) {
|
||||
return Response::json($prop->get());
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('box-bills-unpaid');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $prop->getMd5();
|
||||
|
||||
$bills = $repository->getActiveBills();
|
||||
$unpaid = new Collection; // bills
|
||||
@@ -137,7 +135,7 @@ class JsonController extends Controller
|
||||
}
|
||||
|
||||
$data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
@@ -153,19 +151,18 @@ class JsonController extends Controller
|
||||
$end = Session::get('end', Carbon::now()->endOfMonth());
|
||||
|
||||
// works for json too!
|
||||
$prop = new CacheProperties;
|
||||
$prop->addProperty($start);
|
||||
$prop->addProperty($end);
|
||||
$prop->addProperty('box-in');
|
||||
if ($prop->has()) {
|
||||
return Response::json($prop->get());
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('box-in');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $prop->getMd5();
|
||||
|
||||
$amount = $reportQuery->incomeInPeriodCorrected($start, $end, true)->sum('amount');
|
||||
|
||||
$data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
@@ -182,19 +179,18 @@ class JsonController extends Controller
|
||||
|
||||
|
||||
// works for json too!
|
||||
$prop = new CacheProperties;
|
||||
$prop->addProperty($start);
|
||||
$prop->addProperty($end);
|
||||
$prop->addProperty('box-out');
|
||||
if ($prop->has()) {
|
||||
return Response::json($prop->get());
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('box-out');
|
||||
if ($cache->has()) {
|
||||
return Response::json($cache->get());
|
||||
}
|
||||
$md5 = $prop->getMd5();
|
||||
|
||||
$amount = $reportQuery->expenseInPeriodCorrected($start, $end, true)->sum('amount');
|
||||
|
||||
$data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
|
||||
Cache::forever($md5, $data);
|
||||
$cache->store($data);
|
||||
|
||||
return Response::json($data);
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ class NewUserController extends Controller
|
||||
AccountMeta::create(
|
||||
[
|
||||
'name' => 'ccMonthlyPaymentDate',
|
||||
'data' => Carbon::now()->year.'-01-01',
|
||||
'data' => Carbon::now()->year . '-01-01',
|
||||
'account_id' => $creditCard->id,
|
||||
]
|
||||
);
|
||||
|
@@ -253,7 +253,7 @@ class TransactionController extends Controller
|
||||
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;
|
||||
}
|
||||
|
@@ -1,12 +1,13 @@
|
||||
<?php namespace FireflyIII\Http\Middleware;
|
||||
|
||||
use App;
|
||||
use Carbon\Carbon;
|
||||
use Closure;
|
||||
use Config;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Http\Request;
|
||||
use Preferences;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class Authenticate
|
||||
*
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace FireflyIII\Http\Middleware;
|
||||
|
||||
use App;
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use Closure;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
@@ -54,17 +53,15 @@ class Reminders
|
||||
// do reminders stuff.
|
||||
|
||||
// abuse CacheProperties to find out if we need to do this:
|
||||
$properties = new CacheProperties;
|
||||
$cache = new CacheProperties;
|
||||
|
||||
$properties->addProperty('reminders');
|
||||
if ($properties->has()) {
|
||||
$reminders = $properties->get();
|
||||
$cache->addProperty('reminders');
|
||||
if ($cache->has()) {
|
||||
$reminders = $cache->get();
|
||||
View::share('reminders', $reminders);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
$md5 = $properties->getMd5();
|
||||
|
||||
|
||||
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();
|
||||
|
||||
@@ -89,7 +86,7 @@ class Reminders
|
||||
$reminder->description = $helper->getReminderText($reminder);
|
||||
}
|
||||
);
|
||||
Cache::forever($md5, $reminders);
|
||||
$cache->store($reminders);
|
||||
View::share('reminders', $reminders);
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
*/
|
||||
Breadcrumbs::register(
|
||||
'home',
|
||||
function(Generator $breadcrumbs) {
|
||||
function (Generator $breadcrumbs) {
|
||||
|
||||
$breadcrumbs->push(trans('breadcrumbs.home'), route('index'));
|
||||
}
|
||||
@@ -25,7 +25,7 @@ Breadcrumbs::register(
|
||||
|
||||
Breadcrumbs::register(
|
||||
'index',
|
||||
function(Generator $breadcrumbs) {
|
||||
function (Generator $breadcrumbs) {
|
||||
|
||||
$breadcrumbs->push(trans('breadcrumbs.home'), route('index'));
|
||||
}
|
||||
@@ -34,21 +34,21 @@ Breadcrumbs::register(
|
||||
|
||||
// accounts
|
||||
Breadcrumbs::register(
|
||||
'accounts.index', function(Generator $breadcrumbs, $what) {
|
||||
'accounts.index', function (Generator $breadcrumbs, $what) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.' . strtolower(e($what)) . '_accounts'), route('accounts.index', [$what]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'accounts.create', function(Generator $breadcrumbs, $what) {
|
||||
'accounts.create', function (Generator $breadcrumbs, $what) {
|
||||
$breadcrumbs->parent('accounts.index', $what);
|
||||
$breadcrumbs->push(trans('breadcrumbs.new_' . strtolower(e($what)) . '_account'), route('accounts.create', [$what]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'accounts.show', function(Generator $breadcrumbs, Account $account) {
|
||||
'accounts.show', function (Generator $breadcrumbs, Account $account) {
|
||||
|
||||
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
|
||||
@@ -58,7 +58,7 @@ Breadcrumbs::register(
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'accounts.delete', function(Generator $breadcrumbs, Account $account) {
|
||||
'accounts.delete', function (Generator $breadcrumbs, Account $account) {
|
||||
$breadcrumbs->parent('accounts.show', $account);
|
||||
$breadcrumbs->push(trans('breadcrumbs.delete_account', ['name' => e($account->name)]), route('accounts.delete', [$account->id]));
|
||||
}
|
||||
@@ -66,7 +66,7 @@ Breadcrumbs::register(
|
||||
|
||||
|
||||
Breadcrumbs::register(
|
||||
'accounts.edit', function(Generator $breadcrumbs, Account $account) {
|
||||
'accounts.edit', function (Generator $breadcrumbs, Account $account) {
|
||||
$breadcrumbs->parent('accounts.show', $account);
|
||||
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
|
||||
@@ -76,40 +76,40 @@ Breadcrumbs::register(
|
||||
|
||||
// budgets.
|
||||
Breadcrumbs::register(
|
||||
'budgets.index', function(Generator $breadcrumbs) {
|
||||
'budgets.index', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.budgets'), route('budgets.index'));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'budgets.create', function(Generator $breadcrumbs) {
|
||||
'budgets.create', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('budgets.index');
|
||||
$breadcrumbs->push(trans('breadcrumbs.newBudget'), route('budgets.create'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'budgets.edit', function(Generator $breadcrumbs, Budget $budget) {
|
||||
'budgets.edit', function (Generator $breadcrumbs, Budget $budget) {
|
||||
$breadcrumbs->parent('budgets.show', $budget);
|
||||
$breadcrumbs->push(trans('breadcrumbs.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', [$budget->id]));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'budgets.delete', function(Generator $breadcrumbs, Budget $budget) {
|
||||
'budgets.delete', function (Generator $breadcrumbs, Budget $budget) {
|
||||
$breadcrumbs->parent('budgets.show', $budget);
|
||||
$breadcrumbs->push(trans('breadcrumbs.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', [$budget->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'budgets.noBudget', function(Generator $breadcrumbs, $subTitle) {
|
||||
'budgets.noBudget', function (Generator $breadcrumbs, $subTitle) {
|
||||
$breadcrumbs->parent('budgets.index');
|
||||
$breadcrumbs->push($subTitle, route('budgets.noBudget'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'budgets.show', function(Generator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) {
|
||||
'budgets.show', function (Generator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) {
|
||||
$breadcrumbs->parent('budgets.index');
|
||||
$breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id]));
|
||||
if (!is_null($repetition) && !is_null($repetition->id)) {
|
||||
@@ -122,33 +122,33 @@ Breadcrumbs::register(
|
||||
|
||||
// categories
|
||||
Breadcrumbs::register(
|
||||
'categories.index', function(Generator $breadcrumbs) {
|
||||
'categories.index', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.categories'), route('categories.index'));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'categories.create', function(Generator $breadcrumbs) {
|
||||
'categories.create', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('categories.index');
|
||||
$breadcrumbs->push(trans('breadcrumbs.newCategory'), route('categories.create'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'categories.edit', function(Generator $breadcrumbs, Category $category) {
|
||||
'categories.edit', function (Generator $breadcrumbs, Category $category) {
|
||||
$breadcrumbs->parent('categories.show', $category);
|
||||
$breadcrumbs->push(trans('breadcrumbs.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id]));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'categories.delete', function(Generator $breadcrumbs, Category $category) {
|
||||
'categories.delete', function (Generator $breadcrumbs, Category $category) {
|
||||
$breadcrumbs->parent('categories.show', $category);
|
||||
$breadcrumbs->push(trans('breadcrumbs.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'categories.show', function(Generator $breadcrumbs, Category $category) {
|
||||
'categories.show', function (Generator $breadcrumbs, Category $category) {
|
||||
$breadcrumbs->parent('categories.index');
|
||||
$breadcrumbs->push(e($category->name), route('categories.show', [$category->id]));
|
||||
|
||||
@@ -156,7 +156,7 @@ Breadcrumbs::register(
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'categories.noCategory', function(Generator $breadcrumbs, $subTitle) {
|
||||
'categories.noCategory', function (Generator $breadcrumbs, $subTitle) {
|
||||
$breadcrumbs->parent('categories.index');
|
||||
$breadcrumbs->push($subTitle, route('categories.noCategory'));
|
||||
}
|
||||
@@ -164,20 +164,20 @@ Breadcrumbs::register(
|
||||
|
||||
// currencies.
|
||||
Breadcrumbs::register(
|
||||
'currency.index', function(Generator $breadcrumbs) {
|
||||
'currency.index', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.currencies'), route('currency.index'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'currency.edit', function(Generator $breadcrumbs, TransactionCurrency $currency) {
|
||||
'currency.edit', function (Generator $breadcrumbs, TransactionCurrency $currency) {
|
||||
$breadcrumbs->parent('currency.index');
|
||||
$breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currency.edit', [$currency->id]));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'currency.delete', function(Generator $breadcrumbs, TransactionCurrency $currency) {
|
||||
'currency.delete', function (Generator $breadcrumbs, TransactionCurrency $currency) {
|
||||
$breadcrumbs->parent('currency.index');
|
||||
$breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currency.delete', [$currency->id]));
|
||||
}
|
||||
@@ -186,33 +186,33 @@ Breadcrumbs::register(
|
||||
|
||||
// piggy banks
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.index', function(Generator $breadcrumbs) {
|
||||
'piggy-banks.index', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.piggyBanks'), route('piggy-banks.index'));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.create', function(Generator $breadcrumbs) {
|
||||
'piggy-banks.create', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('piggy-banks.index');
|
||||
$breadcrumbs->push(trans('breadcrumbs.newPiggyBank'), route('piggy-banks.create'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.edit', function(Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
'piggy-banks.edit', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
|
||||
$breadcrumbs->push(trans('breadcrumbs.edit_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.edit', [$piggyBank->id]));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.delete', function(Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
'piggy-banks.delete', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
|
||||
$breadcrumbs->push(trans('breadcrumbs.delete_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', [$piggyBank->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'piggy-banks.show', function(Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
'piggy-banks.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
|
||||
$breadcrumbs->parent('piggy-banks.index');
|
||||
$breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id]));
|
||||
|
||||
@@ -221,7 +221,7 @@ Breadcrumbs::register(
|
||||
|
||||
// preferences
|
||||
Breadcrumbs::register(
|
||||
'preferences', function(Generator $breadcrumbs) {
|
||||
'preferences', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences'));
|
||||
|
||||
@@ -230,14 +230,14 @@ Breadcrumbs::register(
|
||||
|
||||
// profile
|
||||
Breadcrumbs::register(
|
||||
'profile', function(Generator $breadcrumbs) {
|
||||
'profile', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.profile'), route('profile'));
|
||||
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'change-password', function(Generator $breadcrumbs) {
|
||||
'change-password', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('profile');
|
||||
$breadcrumbs->push(trans('breadcrumbs.changePassword'), route('change-password'));
|
||||
|
||||
@@ -246,33 +246,33 @@ Breadcrumbs::register(
|
||||
|
||||
// bills
|
||||
Breadcrumbs::register(
|
||||
'bills.index', function(Generator $breadcrumbs) {
|
||||
'bills.index', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.bills'), route('bills.index'));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'bills.create', function(Generator $breadcrumbs) {
|
||||
'bills.create', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('bills.index');
|
||||
$breadcrumbs->push(trans('breadcrumbs.newBill'), route('bills.create'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'bills.edit', function(Generator $breadcrumbs, Bill $bill) {
|
||||
'bills.edit', function (Generator $breadcrumbs, Bill $bill) {
|
||||
$breadcrumbs->parent('bills.show', $bill);
|
||||
$breadcrumbs->push(trans('breadcrumbs.edit_bill', ['name' => e($bill->name)]), route('bills.edit', [$bill->id]));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'bills.delete', function(Generator $breadcrumbs, Bill $bill) {
|
||||
'bills.delete', function (Generator $breadcrumbs, Bill $bill) {
|
||||
$breadcrumbs->parent('bills.show', $bill);
|
||||
$breadcrumbs->push(trans('breadcrumbs.delete_bill', ['name' => e($bill->name)]), route('bills.delete', [$bill->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'bills.show', function(Generator $breadcrumbs, Bill $bill) {
|
||||
'bills.show', function (Generator $breadcrumbs, Bill $bill) {
|
||||
$breadcrumbs->parent('bills.index');
|
||||
$breadcrumbs->push(e($bill->name), route('bills.show', [$bill->id]));
|
||||
|
||||
@@ -281,7 +281,7 @@ Breadcrumbs::register(
|
||||
|
||||
// reminders
|
||||
Breadcrumbs::register(
|
||||
'reminders.index', function(Generator $breadcrumbs) {
|
||||
'reminders.index', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.reminders'), route('reminders.index'));
|
||||
|
||||
@@ -290,7 +290,7 @@ Breadcrumbs::register(
|
||||
|
||||
// reminders
|
||||
Breadcrumbs::register(
|
||||
'reminders.show', function(Generator $breadcrumbs, Reminder $reminder) {
|
||||
'reminders.show', function (Generator $breadcrumbs, Reminder $reminder) {
|
||||
$breadcrumbs->parent('reminders.index');
|
||||
$breadcrumbs->push(trans('breadcrumbs.reminder', ['id' => e($reminder->id)]), route('reminders.show', [$reminder->id]));
|
||||
|
||||
@@ -300,14 +300,14 @@ Breadcrumbs::register(
|
||||
|
||||
// reports
|
||||
Breadcrumbs::register(
|
||||
'reports.index', function(Generator $breadcrumbs) {
|
||||
'reports.index', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'reports.year', function(Generator $breadcrumbs, Carbon $date, $shared) {
|
||||
'reports.year', function (Generator $breadcrumbs, Carbon $date, $shared) {
|
||||
$breadcrumbs->parent('reports.index');
|
||||
if ($shared) {
|
||||
$title = trans('breadcrumbs.yearly_report_shared', ['date' => $date->year]);
|
||||
@@ -319,7 +319,7 @@ Breadcrumbs::register(
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'reports.month', function(Generator $breadcrumbs, Carbon $date, $shared) {
|
||||
'reports.month', function (Generator $breadcrumbs, Carbon $date, $shared) {
|
||||
$breadcrumbs->parent('reports.year', $date, $shared);
|
||||
|
||||
if ($shared) {
|
||||
@@ -334,7 +334,7 @@ Breadcrumbs::register(
|
||||
|
||||
// search
|
||||
Breadcrumbs::register(
|
||||
'search', function(Generator $breadcrumbs, $query) {
|
||||
'search', function (Generator $breadcrumbs, $query) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search'));
|
||||
}
|
||||
@@ -342,33 +342,33 @@ Breadcrumbs::register(
|
||||
|
||||
// transactions
|
||||
Breadcrumbs::register(
|
||||
'transactions.index', function(Generator $breadcrumbs, $what) {
|
||||
'transactions.index', function (Generator $breadcrumbs, $what) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what]));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'transactions.create', function(Generator $breadcrumbs, $what) {
|
||||
'transactions.create', function (Generator $breadcrumbs, $what) {
|
||||
$breadcrumbs->parent('transactions.index', $what);
|
||||
$breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', [$what]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'transactions.edit', function(Generator $breadcrumbs, TransactionJournal $journal) {
|
||||
'transactions.edit', function (Generator $breadcrumbs, TransactionJournal $journal) {
|
||||
$breadcrumbs->parent('transactions.show', $journal);
|
||||
$breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.edit', [$journal->id]));
|
||||
}
|
||||
);
|
||||
Breadcrumbs::register(
|
||||
'transactions.delete', function(Generator $breadcrumbs, TransactionJournal $journal) {
|
||||
'transactions.delete', function (Generator $breadcrumbs, TransactionJournal $journal) {
|
||||
$breadcrumbs->parent('transactions.show', $journal);
|
||||
$breadcrumbs->push(trans('breadcrumbs.delete_journal', ['description' => e($journal->description)]), route('transactions.delete', [$journal->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'transactions.show', function(Generator $breadcrumbs, TransactionJournal $journal) {
|
||||
'transactions.show', function (Generator $breadcrumbs, TransactionJournal $journal) {
|
||||
|
||||
$breadcrumbs->parent('transactions.index', strtolower($journal->transactionType->type));
|
||||
$breadcrumbs->push($journal->description, route('transactions.show', [$journal->id]));
|
||||
@@ -378,28 +378,28 @@ Breadcrumbs::register(
|
||||
|
||||
// tags
|
||||
Breadcrumbs::register(
|
||||
'tags.index', function(Generator $breadcrumbs) {
|
||||
'tags.index', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('home');
|
||||
$breadcrumbs->push(trans('breadcrumbs.tags'), route('tags.index'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'tags.create', function(Generator $breadcrumbs) {
|
||||
'tags.create', function (Generator $breadcrumbs) {
|
||||
$breadcrumbs->parent('tags.index');
|
||||
$breadcrumbs->push(trans('breadcrumbs.createTag'), route('tags.create'));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'tags.edit', function(Generator $breadcrumbs, Tag $tag) {
|
||||
'tags.edit', function (Generator $breadcrumbs, Tag $tag) {
|
||||
$breadcrumbs->parent('tags.show', $tag);
|
||||
$breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', [$tag->id]));
|
||||
}
|
||||
);
|
||||
|
||||
Breadcrumbs::register(
|
||||
'tags.delete', function(Generator $breadcrumbs, Tag $tag) {
|
||||
'tags.delete', function (Generator $breadcrumbs, Tag $tag) {
|
||||
$breadcrumbs->parent('tags.show', $tag);
|
||||
$breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', [$tag->id]));
|
||||
}
|
||||
@@ -407,7 +407,7 @@ Breadcrumbs::register(
|
||||
|
||||
|
||||
Breadcrumbs::register(
|
||||
'tags.show', function(Generator $breadcrumbs, Tag $tag) {
|
||||
'tags.show', function (Generator $breadcrumbs, Tag $tag) {
|
||||
$breadcrumbs->parent('tags.index');
|
||||
$breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id]));
|
||||
}
|
||||
|
@@ -216,7 +216,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);
|
||||
}
|
||||
);
|
||||
|
@@ -51,7 +51,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'];
|
||||
|
||||
|
@@ -44,7 +44,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'];
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php namespace FireflyIII\Models;
|
||||
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
@@ -136,13 +135,12 @@ class TransactionJournal extends Model
|
||||
*/
|
||||
public function getAmountAttribute()
|
||||
{
|
||||
$prop = new CacheProperties();
|
||||
$prop->addProperty($this->id);
|
||||
$prop->addProperty('amount');
|
||||
if ($prop->has()) {
|
||||
return $prop->get();
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($this->id);
|
||||
$cache->addProperty('amount');
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
$md5 = $prop->getMd5();
|
||||
|
||||
|
||||
$amount = '0';
|
||||
@@ -158,7 +156,7 @@ class TransactionJournal extends Model
|
||||
* If the journal has tags, it gets complicated.
|
||||
*/
|
||||
if ($this->tags->count() == 0) {
|
||||
Cache::forever($md5, $amount);
|
||||
$cache->store($amount);
|
||||
|
||||
return $amount;
|
||||
}
|
||||
@@ -173,7 +171,7 @@ class TransactionJournal extends Model
|
||||
foreach ($others as $other) {
|
||||
$amount = bcsub($amount, $other->actual_amount);
|
||||
}
|
||||
Cache::forever($md5, $amount);
|
||||
$cache->store($amount);
|
||||
|
||||
return $amount;
|
||||
}
|
||||
@@ -181,7 +179,7 @@ class TransactionJournal extends Model
|
||||
// if this journal is part of an advancePayment AND the journal is a deposit,
|
||||
// then the journal amount is correcting a withdrawal, and the amount is zero:
|
||||
if ($advancePayment && $this->transactionType->type == 'Deposit') {
|
||||
Cache::forever($md5, '0');
|
||||
$cache->store('0');
|
||||
|
||||
return '0';
|
||||
}
|
||||
@@ -196,14 +194,14 @@ class TransactionJournal extends Model
|
||||
$transfer = $balancingAct->transactionJournals()->transactionTypes(['Transfer'])->first();
|
||||
if ($transfer) {
|
||||
$amount = bcsub($amount, $transfer->actual_amount);
|
||||
Cache::forever($md5, $amount);
|
||||
$cache->store($amount);
|
||||
|
||||
return $amount;
|
||||
}
|
||||
} // @codeCoverageIgnore
|
||||
} // @codeCoverageIgnore
|
||||
|
||||
Cache::forever($md5, $amount);
|
||||
$cache->store($amount);
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ class BusServiceProvider extends ServiceProvider
|
||||
public function boot(Dispatcher $dispatcher)
|
||||
{
|
||||
$dispatcher->mapUsing(
|
||||
function($command) {
|
||||
function ($command) {
|
||||
return Dispatcher::simpleMapping(
|
||||
$command, 'FireflyIII\Commands', 'FireflyIII\Handlers\Commands'
|
||||
);
|
||||
|
@@ -52,7 +52,7 @@ 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();
|
||||
@@ -91,7 +91,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
protected 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;
|
||||
|
@@ -30,7 +30,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
public 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;
|
||||
}
|
||||
);
|
||||
|
@@ -44,7 +44,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
public function map(Router $router)
|
||||
{
|
||||
$router->group(
|
||||
['namespace' => $this->namespace], function($router) {
|
||||
['namespace' => $this->namespace], function ($router) {
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
require app_path('Http/routes.php');
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ namespace FireflyIII\Repositories\Account;
|
||||
|
||||
use App;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use Config;
|
||||
use DB;
|
||||
@@ -117,7 +116,6 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
$md5 = $cache->getMd5();
|
||||
|
||||
|
||||
if ($preference->data == []) {
|
||||
@@ -126,7 +124,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
$accounts = Auth::user()->accounts()->whereIn('id', $preference->data)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
|
||||
}
|
||||
|
||||
Cache::forever($md5, $accounts);
|
||||
$cache->store($accounts);
|
||||
|
||||
return $accounts;
|
||||
}
|
||||
@@ -144,14 +142,13 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*/
|
||||
public function getFrontpageTransactions(Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
$prop = new CacheProperties();
|
||||
$prop->addProperty($account->id);
|
||||
$prop->addProperty($start);
|
||||
$prop->addProperty($end);
|
||||
if ($prop->has()) {
|
||||
return $prop->get();
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
$md5 = $prop->getMd5();
|
||||
|
||||
$set = Auth::user()
|
||||
->transactionjournals()
|
||||
@@ -166,7 +163,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->take(10)
|
||||
->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);
|
||||
Cache::forever($md5, $set);
|
||||
$cache->store($set);
|
||||
|
||||
return $set;
|
||||
}
|
||||
@@ -238,7 +235,6 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
$md5 = $cache->getMd5();
|
||||
|
||||
$ids = array_unique($ids);
|
||||
if (count($ids) > 0) {
|
||||
@@ -264,7 +260,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
}
|
||||
);
|
||||
|
||||
Cache::forever($md5, $accounts);
|
||||
$cache->store($accounts);
|
||||
|
||||
return $accounts;
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
);
|
||||
@@ -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');
|
||||
}
|
||||
)
|
||||
|
@@ -43,7 +43,7 @@ class ReminderRepository implements ReminderRepositoryInterface
|
||||
->get();
|
||||
|
||||
$active->each(
|
||||
function(Reminder $reminder) {
|
||||
function (Reminder $reminder) {
|
||||
$reminder->description = $this->helper->getReminderText($reminder);
|
||||
}
|
||||
);
|
||||
@@ -62,7 +62,7 @@ class ReminderRepository implements ReminderRepositoryInterface
|
||||
->get();
|
||||
|
||||
$dismissed->each(
|
||||
function(Reminder $reminder) {
|
||||
function (Reminder $reminder) {
|
||||
$reminder->description = $this->helper->getReminderText($reminder);
|
||||
}
|
||||
);
|
||||
@@ -88,7 +88,7 @@ class ReminderRepository implements ReminderRepositoryInterface
|
||||
)->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);
|
||||
}
|
||||
);
|
||||
|
@@ -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;
|
||||
}
|
||||
);
|
||||
|
@@ -99,4 +99,12 @@ class CacheProperties
|
||||
|
||||
$this->md5 = md5($this->md5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
*/
|
||||
public function store($data)
|
||||
{
|
||||
Cache::forever($this->md5, $data);
|
||||
}
|
||||
}
|
@@ -4,6 +4,7 @@ namespace FireflyIII\Support;
|
||||
|
||||
use Auth;
|
||||
use FireflyIII\Models\Preference;
|
||||
|
||||
/**
|
||||
* Class Preferences
|
||||
*
|
||||
@@ -21,14 +22,6 @@ class Preferences
|
||||
return md5($preference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function mark() {
|
||||
$this->set('lastActivity',microtime());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $default
|
||||
@@ -85,4 +78,14 @@ class Preferences
|
||||
return $pref;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function mark()
|
||||
{
|
||||
$this->set('lastActivity', microtime());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ class Search implements SearchInterface
|
||||
public 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'));
|
||||
}
|
||||
);
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FireflyIII\Support;
|
||||
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
|
||||
@@ -25,15 +24,14 @@ class Steam
|
||||
{
|
||||
|
||||
// abuse chart properties:
|
||||
$properties = new CacheProperties;
|
||||
$properties->addProperty($account->id);
|
||||
$properties->addProperty('balance');
|
||||
$properties->addProperty($date);
|
||||
$properties->addProperty($ignoreVirtualBalance);
|
||||
if ($properties->has()) {
|
||||
return $properties->get();
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty($account->id);
|
||||
$cache->addProperty('balance');
|
||||
$cache->addProperty($date);
|
||||
$cache->addProperty($ignoreVirtualBalance);
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
$md5 = $properties->getMd5();
|
||||
|
||||
|
||||
// find the first known transaction on this account:
|
||||
@@ -57,7 +55,7 @@ class Steam
|
||||
if (!$ignoreVirtualBalance) {
|
||||
$balance = bcadd($balance, $account->virtual_balance);
|
||||
}
|
||||
Cache::forever($md5, round($balance, 2));
|
||||
$cache->store(round($balance, 2));
|
||||
|
||||
return round($balance, 2);
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ 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')
|
||||
|
@@ -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;
|
||||
|
@@ -4,7 +4,6 @@ namespace FireflyIII\Support\Twig;
|
||||
|
||||
|
||||
use App;
|
||||
use Cache;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
use Twig_Extension;
|
||||
@@ -30,13 +29,12 @@ class Journal extends Twig_Extension
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'typeIcon', function (TransactionJournal $journal) {
|
||||
|
||||
$prop = new CacheProperties();
|
||||
$prop->addProperty($journal->id);
|
||||
$prop->addProperty('typeIcon');
|
||||
if ($prop->has()) {
|
||||
return $prop->get();
|
||||
$cache = new CacheProperties();
|
||||
$cache->addProperty($journal->id);
|
||||
$cache->addProperty('typeIcon');
|
||||
if ($cache->has()) {
|
||||
return $cache->get();
|
||||
}
|
||||
$md5 = $prop->getMd5();
|
||||
|
||||
$type = $journal->transactionType->type;
|
||||
|
||||
@@ -57,7 +55,7 @@ class Journal extends Twig_Extension
|
||||
$txt = '';
|
||||
break;
|
||||
}
|
||||
Cache::forever($md5, $txt);
|
||||
$cache->store($txt);
|
||||
|
||||
return $txt;
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
);
|
||||
|
@@ -21,7 +21,7 @@ class Translation extends Twig_Extension
|
||||
$filters = [];
|
||||
|
||||
$filters[] = new Twig_SimpleFilter(
|
||||
'_', function($name) {
|
||||
'_', function ($name) {
|
||||
|
||||
return trans('firefly.' . $name);
|
||||
|
||||
|
Reference in New Issue
Block a user