Code cleanup [skip ci]

This commit is contained in:
James Cole
2015-06-03 21:25:11 +02:00
parent 409ec2e086
commit cc7c2e952c
69 changed files with 695 additions and 716 deletions

View File

@@ -64,6 +64,7 @@ class BalanceLine
if ($this->getRole() == self::ROLE_DIFFROLE) { if ($this->getRole() == self::ROLE_DIFFROLE) {
return trans('firefly.leftUnbalanced'); return trans('firefly.leftUnbalanced');
} }
return ''; return '';
} }

View File

@@ -41,7 +41,7 @@ class Bill
public function getBills() public function getBills()
{ {
$this->bills->sortBy( $this->bills->sortBy(
function(BillLine $bill) { function (BillLine $bill) {
$active = intval($bill->getBill()->active) == 0 ? 1 : 0; $active = intval($bill->getBill()->active) == 0 ? 1 : 0;
$name = $bill->getBill()->name; $name = $bill->getBill()->name;

View File

@@ -55,7 +55,7 @@ class Category
public function getCategories() public function getCategories()
{ {
$this->categories->sortByDesc( $this->categories->sortByDesc(
function(CategoryModel $category) { function (CategoryModel $category) {
return $category->spent; return $category->spent;
} }
); );

View File

@@ -67,7 +67,7 @@ class Expense
public function getExpenses() public function getExpenses()
{ {
$this->expenses->sortByDesc( $this->expenses->sortByDesc(
function(stdClass $object) { function (stdClass $object) {
return $object->amount; return $object->amount;
} }
); );

View File

@@ -68,7 +68,7 @@ class Income
public function getIncomes() public function getIncomes()
{ {
$this->incomes->sortByDesc( $this->incomes->sortByDesc(
function(stdClass $object) { function (stdClass $object) {
return $object->amount; return $object->amount;
} }
); );

View File

@@ -66,10 +66,11 @@ class ReportHelper implements ReportHelperInterface
// remove cash account, if any: // remove cash account, if any:
$accounts = $accounts->filter( $accounts = $accounts->filter(
function(Account $account) { function (Account $account) {
if ($account->accountType->type != 'Cash account') { if ($account->accountType->type != 'Cash account') {
return $account; return $account;
} }
return null; return null;
} }
); );

View File

@@ -5,9 +5,9 @@ namespace FireflyIII\Helpers\Report;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account as AccountCollection; use FireflyIII\Helpers\Collection\Account as AccountCollection;
use FireflyIII\Helpers\Collection\Balance; use FireflyIII\Helpers\Collection\Balance;
use FireflyIII\Helpers\Collection\Bill as BillCollection;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection; use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use FireflyIII\Helpers\Collection\Category as CategoryCollection; use FireflyIII\Helpers\Collection\Category as CategoryCollection;
use FireflyIII\Helpers\Collection\Bill as BillCollection;
use FireflyIII\Helpers\Collection\Expense; use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income; use FireflyIII\Helpers\Collection\Income;

View File

@@ -35,15 +35,15 @@ class ReportQuery implements ReportQueryInterface
$query = $this->queryJournalsWithTransactions($start, $end); $query = $this->queryJournalsWithTransactions($start, $end);
if ($includeShared === false) { if ($includeShared === false) {
$query->where( $query->where(
function(Builder $query) { function (Builder $query) {
$query->where( $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('transaction_types.type', 'Withdrawal');
$q->where('acm_from.data', '!=', '"sharedAsset"'); $q->where('acm_from.data', '!=', '"sharedAsset"');
} }
); );
$query->orWhere( $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('transaction_types.type', 'Transfer');
$q->where('acm_to.data', '=', '"sharedAsset"'); $q->where('acm_to.data', '=', '"sharedAsset"');
} }
@@ -61,17 +61,18 @@ class ReportQuery implements ReportQueryInterface
); );
$data->each( $data->each(
function(TransactionJournal $journal) { function (TransactionJournal $journal) {
if (intval($journal->account_encrypted) == 1) { if (intval($journal->account_encrypted) == 1) {
$journal->name = Crypt::decrypt($journal->name); $journal->name = Crypt::decrypt($journal->name);
} }
} }
); );
$data = $data->filter( $data = $data->filter(
function(TransactionJournal $journal) { function (TransactionJournal $journal) {
if ($journal->amount != 0) { if ($journal->amount != 0) {
return $journal; return $journal;
} }
return null; return null;
} }
); );
@@ -91,26 +92,26 @@ class ReportQuery implements ReportQueryInterface
public function getAllAccounts(Carbon $start, Carbon $end, $includeShared = false) public function getAllAccounts(Carbon $start, Carbon $end, $includeShared = false)
{ {
$query = Auth::user()->accounts()->orderBy('accounts.name', 'ASC') $query = Auth::user()->accounts()->orderBy('accounts.name', 'ASC')
->accountTypeIn(['Default account', 'Asset account', 'Cash account']); ->accountTypeIn(['Default account', 'Asset account', 'Cash account']);
if ($includeShared === false) { if ($includeShared === false) {
$query->leftJoin( $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'); $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
} }
) )
->orderBy('accounts.name', 'ASC') ->orderBy('accounts.name', 'ASC')
->where( ->where(
function(Builder $query) { function (Builder $query) {
$query->where('account_meta.data', '!=', '"sharedAsset"'); $query->where('account_meta.data', '!=', '"sharedAsset"');
$query->orWhereNull('account_meta.data'); $query->orWhereNull('account_meta.data');
} }
); );
} }
$set = $query->get(['accounts.*']); $set = $query->get(['accounts.*']);
$set->each( $set->each(
function(Account $account) use ($start, $end) { function (Account $account) use ($start, $end) {
/** /**
* The balance for today always incorporates transactions * The balance for today always incorporates transactions
* made on today. So to get todays "start" balance, we sub one * 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 // only get deposits not to a shared account
// and transfers to a shared account. // and transfers to a shared account.
$query->where( $query->where(
function(Builder $query) { function (Builder $query) {
$query->where( $query->where(
function(Builder $q) { function (Builder $q) {
$q->where('transaction_types.type', 'Deposit'); $q->where('transaction_types.type', 'Deposit');
$q->where('acm_to.data', '!=', '"sharedAsset"'); $q->where('acm_to.data', '!=', '"sharedAsset"');
} }
); );
$query->orWhere( $query->orWhere(
function(Builder $q) { function (Builder $q) {
$q->where('transaction_types.type', 'Transfer'); $q->where('transaction_types.type', 'Transfer');
$q->where('acm_from.data', '=', '"sharedAsset"'); $q->where('acm_from.data', '=', '"sharedAsset"');
} }
@@ -178,17 +179,18 @@ class ReportQuery implements ReportQueryInterface
); );
$data->each( $data->each(
function(TransactionJournal $journal) { function (TransactionJournal $journal) {
if (intval($journal->account_encrypted) == 1) { if (intval($journal->account_encrypted) == 1) {
$journal->name = Crypt::decrypt($journal->name); $journal->name = Crypt::decrypt($journal->name);
} }
} }
); );
$data = $data->filter( $data = $data->filter(
function(TransactionJournal $journal) { function (TransactionJournal $journal) {
if ($journal->amount != 0) { if ($journal->amount != 0) {
return $journal; return $journal;
} }
return null; return null;
} }
); );
@@ -210,16 +212,16 @@ class ReportQuery implements ReportQueryInterface
{ {
return floatval( return floatval(
Auth::user()->transactionjournals() Auth::user()->transactionjournals()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->transactionTypes(['Withdrawal']) ->transactionTypes(['Withdrawal'])
->where('transactions.account_id', $account->id) ->where('transactions.account_id', $account->id)
->before($end) ->before($end)
->after($start) ->after($start)
->where('budget_transaction_journal.budget_id', $budget->id) ->where('budget_transaction_journal.budget_id', $budget->id)
->get(['transaction_journals.*'])->sum('amount') ->get(['transaction_journals.*'])->sum('amount')
) * -1; ) * -1;
} }
/** /**
@@ -254,28 +256,28 @@ class ReportQuery implements ReportQueryInterface
{ {
$query = TransactionJournal:: $query = TransactionJournal::
leftJoin( 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); $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('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id')
->leftJoin( ->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'); $join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole');
} }
) )
->leftJoin( ->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); $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('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id')
->leftJoin( ->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'); $join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole');
} }
) )
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id'); ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id');
$query->before($end)->after($start)->where('transaction_journals.user_id', Auth::user()->id); $query->before($end)->after($start)->where('transaction_journals.user_id', Auth::user()->id);
return $query; return $query;

View File

@@ -7,12 +7,13 @@ use FireflyIII\Http\Requests\AccountFormRequest;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input; use Input;
use Preferences;
use Redirect; use Redirect;
use Session; use Session;
use Steam; use Steam;
use URL; use URL;
use View; use View;
use Preferences;
/** /**
* Class AccountController * Class AccountController
* *
@@ -155,7 +156,7 @@ class AccountController extends Controller
$start = clone Session::get('start', Carbon::now()->startOfMonth()); $start = clone Session::get('start', Carbon::now()->startOfMonth());
$start->subDay(); $start->subDay();
$accounts->each( $accounts->each(
function(Account $account) use ($start, $repository) { function (Account $account) use ($start, $repository) {
$account->lastActivityDate = $repository->getLastActivity($account); $account->lastActivityDate = $repository->getLastActivity($account);
$account->startBalance = Steam::balance($account, $start); $account->startBalance = Steam::balance($account, $start);
$account->endBalance = Steam::balance($account, clone Session::get('end', Carbon::now()->endOfMonth())); $account->endBalance = Steam::balance($account, clone Session::get('end', Carbon::now()->endOfMonth()));
@@ -200,11 +201,11 @@ class AccountController extends Controller
'user' => Auth::user()->id, 'user' => Auth::user()->id,
'accountRole' => $request->input('accountRole'), 'accountRole' => $request->input('accountRole'),
'openingBalance' => floatval($request->input('openingBalance')), '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')), 'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
]; ];
$account = $repository->store($accountData); $account = $repository->store($accountData);
Session::flash('success', 'New account "' . $account->name . '" stored!'); Session::flash('success', 'New account "' . $account->name . '" stored!');
Preferences::mark(); Preferences::mark();
@@ -239,7 +240,7 @@ class AccountController extends Controller
'accountRole' => $request->input('accountRole'), 'accountRole' => $request->input('accountRole'),
'virtualBalance' => floatval($request->input('virtualBalance')), 'virtualBalance' => floatval($request->input('virtualBalance')),
'openingBalance' => floatval($request->input('openingBalance')), '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')), 'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
'ccType' => $request->input('ccType'), 'ccType' => $request->input('ccType'),
'ccMonthlyPaymentDate' => $request->input('ccMonthlyPaymentDate'), 'ccMonthlyPaymentDate' => $request->input('ccMonthlyPaymentDate'),

View File

@@ -109,7 +109,7 @@ class AuthController extends Controller
if (User::count() == 1) { if (User::count() == 1) {
$admin = Role::where('name', 'owner')->first(); $admin = Role::where('name', 'owner')->first();
$this->auth->user()->attachRole($admin); $this->auth->user()->attachRole($admin);
// $this->auth->user()->roles()->save($admin); // $this->auth->user()->roles()->save($admin);
} }

View File

@@ -112,7 +112,7 @@ class BillController extends Controller
{ {
$bills = $repository->getBills(); $bills = $repository->getBills();
$bills->each( $bills->each(
function(Bill $bill) use ($repository) { function (Bill $bill) use ($repository) {
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill); $bill->nextExpectedMatch = $repository->nextExpectedMatch($bill);
$bill->lastFoundMatch = $repository->lastFoundMatch($bill); $bill->lastFoundMatch = $repository->lastFoundMatch($bill);
} }

View File

@@ -242,7 +242,7 @@ class BudgetController extends Controller
'name' => $request->input('name'), 'name' => $request->input('name'),
'user' => Auth::user()->id, 'user' => Auth::user()->id,
]; ];
$budget = $repository->store($budgetData); $budget = $repository->store($budgetData);
Session::flash('success', 'New budget "' . $budget->name . '" stored!'); Session::flash('success', 'New budget "' . $budget->name . '" stored!');
Preferences::mark(); Preferences::mark();

View File

@@ -114,7 +114,7 @@ class CategoryController extends Controller
$categories = $repository->getCategories(); $categories = $repository->getCategories();
$categories->each( $categories->each(
function(Category $category) use ($repository) { function (Category $category) use ($repository) {
$category->lastActivity = $repository->getLatestActivity($category); $category->lastActivity = $repository->getLatestActivity($category);
} }
); );
@@ -167,7 +167,7 @@ class CategoryController extends Controller
'name' => $request->input('name'), 'name' => $request->input('name'),
'user' => Auth::user()->id, 'user' => Auth::user()->id,
]; ];
$category = $repository->store($categoryData); $category = $repository->store($categoryData);
Session::flash('success', 'New category "' . $category->name . '" stored!'); Session::flash('success', 'New category "' . $category->name . '" stored!');
Preferences::mark(); Preferences::mark();

View File

@@ -2,8 +2,6 @@
namespace FireflyIII\Http\Controllers\Chart; namespace FireflyIII\Http\Controllers\Chart;
use Auth;
use Cache;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -11,7 +9,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\CacheProperties; use FireflyIII\Support\CacheProperties;
use Grumpydictator\Gchart\GChart; use Grumpydictator\Gchart\GChart;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log;
use Preferences; use Preferences;
use Response; use Response;
use Session; use Session;
@@ -43,15 +40,14 @@ class AccountController extends Controller
$end->endOfMonth(); $end->endOfMonth();
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties(); $cache = new CacheProperties();
$chartProperties->addProperty($start); $cache->addProperty($start);
$chartProperties->addProperty($end); $cache->addProperty($end);
$chartProperties->addProperty('all'); $cache->addProperty('all');
$chartProperties->addProperty('accounts'); $cache->addProperty('accounts');
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
$chart->addColumn(trans('firefly.dayOfMonth'), 'date'); $chart->addColumn(trans('firefly.dayOfMonth'), 'date');
@@ -91,7 +87,7 @@ class AccountController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }
@@ -114,15 +110,14 @@ class AccountController extends Controller
$accounts = $repository->getFrontpageAccounts($frontPage); $accounts = $repository->getFrontpageAccounts($frontPage);
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties(); $cache = new CacheProperties();
$chartProperties->addProperty($start); $cache->addProperty($start);
$chartProperties->addProperty($end); $cache->addProperty($end);
$chartProperties->addProperty('frontpage'); $cache->addProperty('frontpage');
$chartProperties->addProperty('accounts'); $cache->addProperty('accounts');
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
$index = 1; $index = 1;
@@ -148,7 +143,7 @@ class AccountController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
@@ -174,18 +169,15 @@ class AccountController extends Controller
$today = new Carbon; $today = new Carbon;
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties(); $cache = new CacheProperties();
$chartProperties->addProperty($start); $cache->addProperty($start);
$chartProperties->addProperty($end); $cache->addProperty($end);
$chartProperties->addProperty('frontpage'); $cache->addProperty('frontpage');
$chartProperties->addProperty('single'); $cache->addProperty('single');
$chartProperties->addProperty($account->id); $cache->addProperty($account->id);
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
while ($end >= $current) { while ($end >= $current) {
$certain = $current < $today; $certain = $current < $today;
@@ -197,7 +189,7 @@ class AccountController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }

View File

@@ -14,8 +14,7 @@ use Illuminate\Support\Collection;
use Response; use Response;
use Session; use Session;
use Steam; use Steam;
use Cache;
use Log;
/** /**
* Class BillController * Class BillController
* *
@@ -40,14 +39,13 @@ class BillController extends Controller
$chart->addColumn(trans('firefly.minAmount'), 'number'); $chart->addColumn(trans('firefly.minAmount'), 'number');
$chart->addColumn(trans('firefly.billEntry'), 'number'); $chart->addColumn(trans('firefly.billEntry'), 'number');
$chartProperties = new CacheProperties; $cache = new CacheProperties;
$chartProperties->addProperty('single'); $cache->addProperty('single');
$chartProperties->addProperty('bill'); $cache->addProperty('bill');
$chartProperties->addProperty($bill->id); $cache->addProperty($bill->id);
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
// get first transaction or today for start: // get first transaction or today for start:
$results = $repository->getJournals($bill); $results = $repository->getJournals($bill);
@@ -59,7 +57,7 @@ class BillController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }
@@ -79,20 +77,19 @@ class BillController extends Controller
$chart->addColumn(trans('firefly.name'), 'string'); $chart->addColumn(trans('firefly.name'), 'string');
$chart->addColumn(trans('firefly.amount'), 'number'); $chart->addColumn(trans('firefly.amount'), 'number');
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = Session::get('end', Carbon::now()->endOfMonth());
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties(); $cache = new CacheProperties();
$chartProperties->addProperty($start); $cache->addProperty($start);
$chartProperties->addProperty($end); $cache->addProperty($end);
$chartProperties->addProperty('bills'); $cache->addProperty('bills');
$chartProperties->addProperty('frontpage'); $cache->addProperty('frontpage');
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
$bills = $repository->getActiveBills(); $bills = $repository->getActiveBills();
$paid = new Collection; // journals. $paid = new Collection; // journals.
@@ -163,7 +160,7 @@ class BillController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Http\Controllers\Chart; namespace FireflyIII\Http\Controllers\Chart;
use Cache;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Budget; use FireflyIII\Models\Budget;
@@ -11,7 +10,6 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Support\CacheProperties; use FireflyIII\Support\CacheProperties;
use Grumpydictator\Gchart\GChart; use Grumpydictator\Gchart\GChart;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log;
use Navigation; use Navigation;
use Preferences; use Preferences;
use Response; use Response;
@@ -45,15 +43,14 @@ class BudgetController extends Controller
$last = Navigation::endOfX($last, $range, $final); $last = Navigation::endOfX($last, $range, $final);
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties(); $cache = new CacheProperties();
$chartProperties->addProperty($first); $cache->addProperty($first);
$chartProperties->addProperty($last); $cache->addProperty($last);
$chartProperties->addProperty('budget'); $cache->addProperty('budget');
$chartProperties->addProperty('budget'); $cache->addProperty('budget');
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
while ($first < $last) { while ($first < $last) {
@@ -69,7 +66,7 @@ class BudgetController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }
@@ -90,17 +87,16 @@ class BudgetController extends Controller
$end = $repetition->enddate; $end = $repetition->enddate;
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties(); $cache = new CacheProperties();
$chartProperties->addProperty($start); $cache->addProperty($start);
$chartProperties->addProperty($end); $cache->addProperty($end);
$chartProperties->addProperty('budget'); $cache->addProperty('budget');
$chartProperties->addProperty('limit'); $cache->addProperty('limit');
$chartProperties->addProperty($budget->id); $cache->addProperty($budget->id);
$chartProperties->addProperty($repetition->id); $cache->addProperty($repetition->id);
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
$chart->addColumn(trans('firefly.day'), 'date'); $chart->addColumn(trans('firefly.day'), 'date');
$chart->addColumn(trans('firefly.left'), 'number'); $chart->addColumn(trans('firefly.left'), 'number');
@@ -120,7 +116,7 @@ class BudgetController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
@@ -147,15 +143,14 @@ class BudgetController extends Controller
$allEntries = new Collection; $allEntries = new Collection;
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties(); $cache = new CacheProperties();
$chartProperties->addProperty($start); $cache->addProperty($start);
$chartProperties->addProperty($end); $cache->addProperty($end);
$chartProperties->addProperty('budget'); $cache->addProperty('budget');
$chartProperties->addProperty('all'); $cache->addProperty('all');
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
/** @var Budget $budget */ /** @var Budget $budget */
@@ -194,7 +189,7 @@ class BudgetController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
@@ -218,15 +213,14 @@ class BudgetController extends Controller
$budgets = $repository->getBudgets(); $budgets = $repository->getBudgets();
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties(); $cache = new CacheProperties();
$chartProperties->addProperty($start); $cache->addProperty($start);
$chartProperties->addProperty($end); $cache->addProperty($end);
$chartProperties->addProperty('budget'); $cache->addProperty('budget');
$chartProperties->addProperty('year'); $cache->addProperty('year');
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
// add columns: // add columns:
$chart->addColumn(trans('firefly.month'), 'date'); $chart->addColumn(trans('firefly.month'), 'date');
@@ -254,7 +248,7 @@ class BudgetController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }

View File

@@ -3,14 +3,12 @@
namespace FireflyIII\Http\Controllers\Chart; namespace FireflyIII\Http\Controllers\Chart;
use Cache;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Category; use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Support\CacheProperties; use FireflyIII\Support\CacheProperties;
use Grumpydictator\Gchart\GChart; use Grumpydictator\Gchart\GChart;
use Log;
use Navigation; use Navigation;
use Preferences; use Preferences;
use Response; use Response;
@@ -80,22 +78,21 @@ class CategoryController extends Controller
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = Session::get('end', Carbon::now()->endOfMonth());
// chart properties for cache: // chart properties for cache:
$chartProperties = new CacheProperties; $cache = new CacheProperties;
$chartProperties->addProperty($start); $cache->addProperty($start);
$chartProperties->addProperty($end); $cache->addProperty($end);
$chartProperties->addProperty('category'); $cache->addProperty('category');
$chartProperties->addProperty('frontpage'); $cache->addProperty('frontpage');
if ($chartProperties->has()) { if ($cache->has()) {
return Response::json($chartProperties->get()); return Response::json($cache->get());
} }
$md5 = $chartProperties->getMd5();
$set = $repository->getCategoriesAndExpensesCorrected($start, $end); $set = $repository->getCategoriesAndExpensesCorrected($start, $end);
// sort by callback: // sort by callback:
uasort( uasort(
$set, $set,
function($left, $right) { function ($left, $right) {
if ($left['sum'] == $right['sum']) { if ($left['sum'] == $right['sum']) {
return 0; return 0;
} }
@@ -115,7 +112,7 @@ class CategoryController extends Controller
$chart->generate(); $chart->generate();
$data = $chart->getData(); $data = $chart->getData();
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);

View File

@@ -2,7 +2,6 @@
use Carbon\Carbon; use Carbon\Carbon;
use Config; use Config;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input; use Input;
use Preferences; use Preferences;
@@ -61,20 +60,19 @@ class HomeController extends Controller
return Redirect::route('new-user.index'); return Redirect::route('new-user.index');
} }
$title = 'Firefly'; $title = 'Firefly';
$subTitle = trans('firefly.welcomeBack'); $subTitle = trans('firefly.welcomeBack');
$mainTitleIcon = 'fa-fire'; $mainTitleIcon = 'fa-fire';
$transactions = []; $transactions = [];
$frontPage = Preferences::get('frontPageAccounts', []); $frontPage = Preferences::get('frontPageAccounts', []);
$start = Session::get('start', Carbon::now()->startOfMonth()); $start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = Session::get('end', Carbon::now()->endOfMonth());
$accounts = $repository->getFrontpageAccounts($frontPage); $accounts = $repository->getFrontpageAccounts($frontPage);
$savings = $repository->getSavingsAccounts(); $savings = $repository->getSavingsAccounts();
$piggyBankAccounts = $repository->getPiggyBankAccounts(); $piggyBankAccounts = $repository->getPiggyBankAccounts();
$savingsTotal = 0; $savingsTotal = 0;
foreach ($savings as $savingAccount) { foreach ($savings as $savingAccount) {
$savingsTotal += Steam::balance($savingAccount, $end); $savingsTotal += Steam::balance($savingAccount, $end);
@@ -95,6 +93,7 @@ class HomeController extends Controller
$transactions[] = [$set, $account]; $transactions[] = [$set, $account];
} }
} }
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts')); return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts'));
} }

View File

@@ -1,7 +1,6 @@
<?php namespace FireflyIII\Http\Controllers; <?php namespace FireflyIII\Http\Controllers;
use Amount; use Amount;
use Cache;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportQueryInterface; use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -39,14 +38,13 @@ class JsonController extends Controller
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = Session::get('end', Carbon::now()->endOfMonth());
// works for json too! // works for json too!
$prop = new CacheProperties; $cache = new CacheProperties;
$prop->addProperty($start); $cache->addProperty($start);
$prop->addProperty($end); $cache->addProperty($end);
$prop->addProperty('box-bills-paid'); $cache->addProperty('box-bills-paid');
if ($prop->has()) { if ($cache->has()) {
return Response::json($prop->get()); return Response::json($cache->get());
} }
$md5 = $prop->getMd5();
$amount = 0; $amount = 0;
@@ -75,7 +73,8 @@ class JsonController extends Controller
} }
} }
$data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]; $data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }
@@ -93,14 +92,13 @@ class JsonController extends Controller
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = Session::get('end', Carbon::now()->endOfMonth());
// works for json too! // works for json too!
$prop = new CacheProperties; $cache = new CacheProperties;
$prop->addProperty($start); $cache->addProperty($start);
$prop->addProperty($end); $cache->addProperty($end);
$prop->addProperty('box-bills-unpaid'); $cache->addProperty('box-bills-unpaid');
if ($prop->has()) { if ($cache->has()) {
return Response::json($prop->get()); return Response::json($cache->get());
} }
$md5 = $prop->getMd5();
$bills = $repository->getActiveBills(); $bills = $repository->getActiveBills();
$unpaid = new Collection; // bills $unpaid = new Collection; // bills
@@ -137,7 +135,7 @@ class JsonController extends Controller
} }
$data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]; $data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }
@@ -153,19 +151,18 @@ class JsonController extends Controller
$end = Session::get('end', Carbon::now()->endOfMonth()); $end = Session::get('end', Carbon::now()->endOfMonth());
// works for json too! // works for json too!
$prop = new CacheProperties; $cache = new CacheProperties;
$prop->addProperty($start); $cache->addProperty($start);
$prop->addProperty($end); $cache->addProperty($end);
$prop->addProperty('box-in'); $cache->addProperty('box-in');
if ($prop->has()) { if ($cache->has()) {
return Response::json($prop->get()); return Response::json($cache->get());
} }
$md5 = $prop->getMd5();
$amount = $reportQuery->incomeInPeriodCorrected($start, $end, true)->sum('amount'); $amount = $reportQuery->incomeInPeriodCorrected($start, $end, true)->sum('amount');
$data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]; $data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }
@@ -182,19 +179,18 @@ class JsonController extends Controller
// works for json too! // works for json too!
$prop = new CacheProperties; $cache = new CacheProperties;
$prop->addProperty($start); $cache->addProperty($start);
$prop->addProperty($end); $cache->addProperty($end);
$prop->addProperty('box-out'); $cache->addProperty('box-out');
if ($prop->has()) { if ($cache->has()) {
return Response::json($prop->get()); return Response::json($cache->get());
} }
$md5 = $prop->getMd5();
$amount = $reportQuery->expenseInPeriodCorrected($start, $end, true)->sum('amount'); $amount = $reportQuery->expenseInPeriodCorrected($start, $end, true)->sum('amount');
$data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]; $data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
Cache::forever($md5, $data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }

View File

@@ -107,7 +107,7 @@ class NewUserController extends Controller
AccountMeta::create( AccountMeta::create(
[ [
'name' => 'ccMonthlyPaymentDate', 'name' => 'ccMonthlyPaymentDate',
'data' => Carbon::now()->year.'-01-01', 'data' => Carbon::now()->year . '-01-01',
'account_id' => $creditCard->id, 'account_id' => $creditCard->id,
] ]
); );

View File

@@ -139,11 +139,11 @@ class PiggyBankController extends Controller
$targetDate = $targetDate->format('Y-m-d'); $targetDate = $targetDate->format('Y-m-d');
} }
$preFilled = ['name' => $piggyBank->name, $preFilled = ['name' => $piggyBank->name,
'account_id' => $piggyBank->account_id, 'account_id' => $piggyBank->account_id,
'targetamount' => $piggyBank->targetamount, 'targetamount' => $piggyBank->targetamount,
'targetdate' => $targetDate, 'targetdate' => $targetDate,
'reminder' => $piggyBank->reminder, 'reminder' => $piggyBank->reminder,
'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false 'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false
]; ];
Session::flash('preFilled', $preFilled); Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'piggy-banks'); Session::flash('gaEventCategory', 'piggy-banks');

View File

@@ -253,7 +253,7 @@ class TransactionController extends Controller
public function show(JournalRepositoryInterface $repository, TransactionJournal $journal) public function show(JournalRepositoryInterface $repository, TransactionJournal $journal)
{ {
$journal->transactions->each( $journal->transactions->each(
function(Transaction $t) use ($journal, $repository) { function (Transaction $t) use ($journal, $repository) {
$t->before = $repository->getAmountBefore($journal, $t); $t->before = $repository->getAmountBefore($journal, $t);
$t->after = $t->before + $t->amount; $t->after = $t->before + $t->amount;
} }

View File

@@ -1,12 +1,13 @@
<?php namespace FireflyIII\Http\Middleware; <?php namespace FireflyIII\Http\Middleware;
use App; use App;
use Carbon\Carbon;
use Closure; use Closure;
use Config; use Config;
use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Preferences; use Preferences;
use Carbon\Carbon;
/** /**
* Class Authenticate * Class Authenticate
* *

View File

@@ -3,7 +3,6 @@
namespace FireflyIII\Http\Middleware; namespace FireflyIII\Http\Middleware;
use App; use App;
use Cache;
use Carbon\Carbon; use Carbon\Carbon;
use Closure; use Closure;
use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBank;
@@ -54,17 +53,15 @@ class Reminders
// do reminders stuff. // do reminders stuff.
// abuse CacheProperties to find out if we need to do this: // abuse CacheProperties to find out if we need to do this:
$properties = new CacheProperties; $cache = new CacheProperties;
$properties->addProperty('reminders'); $cache->addProperty('reminders');
if ($properties->has()) { if ($cache->has()) {
$reminders = $properties->get(); $reminders = $cache->get();
View::share('reminders', $reminders); View::share('reminders', $reminders);
return $next($request); return $next($request);
} }
$md5 = $properties->getMd5();
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get(); $piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();
@@ -89,7 +86,7 @@ class Reminders
$reminder->description = $helper->getReminderText($reminder); $reminder->description = $helper->getReminderText($reminder);
} }
); );
Cache::forever($md5, $reminders); $cache->store($reminders);
View::share('reminders', $reminders); View::share('reminders', $reminders);
} }

View File

@@ -17,7 +17,7 @@ use FireflyIII\Models\TransactionJournal;
*/ */
Breadcrumbs::register( Breadcrumbs::register(
'home', 'home',
function(Generator $breadcrumbs) { function (Generator $breadcrumbs) {
$breadcrumbs->push(trans('breadcrumbs.home'), route('index')); $breadcrumbs->push(trans('breadcrumbs.home'), route('index'));
} }
@@ -25,7 +25,7 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'index', 'index',
function(Generator $breadcrumbs) { function (Generator $breadcrumbs) {
$breadcrumbs->push(trans('breadcrumbs.home'), route('index')); $breadcrumbs->push(trans('breadcrumbs.home'), route('index'));
} }
@@ -34,21 +34,21 @@ Breadcrumbs::register(
// accounts // accounts
Breadcrumbs::register( Breadcrumbs::register(
'accounts.index', function(Generator $breadcrumbs, $what) { 'accounts.index', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.' . strtolower(e($what)) . '_accounts'), route('accounts.index', [$what])); $breadcrumbs->push(trans('breadcrumbs.' . strtolower(e($what)) . '_accounts'), route('accounts.index', [$what]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'accounts.create', function(Generator $breadcrumbs, $what) { 'accounts.create', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('accounts.index', $what); $breadcrumbs->parent('accounts.index', $what);
$breadcrumbs->push(trans('breadcrumbs.new_' . strtolower(e($what)) . '_account'), route('accounts.create', [$what])); $breadcrumbs->push(trans('breadcrumbs.new_' . strtolower(e($what)) . '_account'), route('accounts.create', [$what]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'accounts.show', function(Generator $breadcrumbs, Account $account) { 'accounts.show', function (Generator $breadcrumbs, Account $account) {
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type); $what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
@@ -58,7 +58,7 @@ Breadcrumbs::register(
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'accounts.delete', function(Generator $breadcrumbs, Account $account) { 'accounts.delete', function (Generator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account); $breadcrumbs->parent('accounts.show', $account);
$breadcrumbs->push(trans('breadcrumbs.delete_account', ['name' => e($account->name)]), route('accounts.delete', [$account->id])); $breadcrumbs->push(trans('breadcrumbs.delete_account', ['name' => e($account->name)]), route('accounts.delete', [$account->id]));
} }
@@ -66,7 +66,7 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'accounts.edit', function(Generator $breadcrumbs, Account $account) { 'accounts.edit', function (Generator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account); $breadcrumbs->parent('accounts.show', $account);
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type); $what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
@@ -76,40 +76,40 @@ Breadcrumbs::register(
// budgets. // budgets.
Breadcrumbs::register( Breadcrumbs::register(
'budgets.index', function(Generator $breadcrumbs) { 'budgets.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.budgets'), route('budgets.index')); $breadcrumbs->push(trans('breadcrumbs.budgets'), route('budgets.index'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'budgets.create', function(Generator $breadcrumbs) { 'budgets.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('budgets.index'); $breadcrumbs->parent('budgets.index');
$breadcrumbs->push(trans('breadcrumbs.newBudget'), route('budgets.create')); $breadcrumbs->push(trans('breadcrumbs.newBudget'), route('budgets.create'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'budgets.edit', function(Generator $breadcrumbs, Budget $budget) { 'budgets.edit', function (Generator $breadcrumbs, Budget $budget) {
$breadcrumbs->parent('budgets.show', $budget); $breadcrumbs->parent('budgets.show', $budget);
$breadcrumbs->push(trans('breadcrumbs.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', [$budget->id])); $breadcrumbs->push(trans('breadcrumbs.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', [$budget->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'budgets.delete', function(Generator $breadcrumbs, Budget $budget) { 'budgets.delete', function (Generator $breadcrumbs, Budget $budget) {
$breadcrumbs->parent('budgets.show', $budget); $breadcrumbs->parent('budgets.show', $budget);
$breadcrumbs->push(trans('breadcrumbs.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', [$budget->id])); $breadcrumbs->push(trans('breadcrumbs.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', [$budget->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'budgets.noBudget', function(Generator $breadcrumbs, $subTitle) { 'budgets.noBudget', function (Generator $breadcrumbs, $subTitle) {
$breadcrumbs->parent('budgets.index'); $breadcrumbs->parent('budgets.index');
$breadcrumbs->push($subTitle, route('budgets.noBudget')); $breadcrumbs->push($subTitle, route('budgets.noBudget'));
} }
); );
Breadcrumbs::register( 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->parent('budgets.index');
$breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id])); $breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id]));
if (!is_null($repetition) && !is_null($repetition->id)) { if (!is_null($repetition) && !is_null($repetition->id)) {
@@ -122,33 +122,33 @@ Breadcrumbs::register(
// categories // categories
Breadcrumbs::register( Breadcrumbs::register(
'categories.index', function(Generator $breadcrumbs) { 'categories.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.categories'), route('categories.index')); $breadcrumbs->push(trans('breadcrumbs.categories'), route('categories.index'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.create', function(Generator $breadcrumbs) { 'categories.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('categories.index'); $breadcrumbs->parent('categories.index');
$breadcrumbs->push(trans('breadcrumbs.newCategory'), route('categories.create')); $breadcrumbs->push(trans('breadcrumbs.newCategory'), route('categories.create'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.edit', function(Generator $breadcrumbs, Category $category) { 'categories.edit', function (Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category); $breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('breadcrumbs.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id])); $breadcrumbs->push(trans('breadcrumbs.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.delete', function(Generator $breadcrumbs, Category $category) { 'categories.delete', function (Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category); $breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('breadcrumbs.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id])); $breadcrumbs->push(trans('breadcrumbs.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.show', function(Generator $breadcrumbs, Category $category) { 'categories.show', function (Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.index'); $breadcrumbs->parent('categories.index');
$breadcrumbs->push(e($category->name), route('categories.show', [$category->id])); $breadcrumbs->push(e($category->name), route('categories.show', [$category->id]));
@@ -156,7 +156,7 @@ Breadcrumbs::register(
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.noCategory', function(Generator $breadcrumbs, $subTitle) { 'categories.noCategory', function (Generator $breadcrumbs, $subTitle) {
$breadcrumbs->parent('categories.index'); $breadcrumbs->parent('categories.index');
$breadcrumbs->push($subTitle, route('categories.noCategory')); $breadcrumbs->push($subTitle, route('categories.noCategory'));
} }
@@ -164,20 +164,20 @@ Breadcrumbs::register(
// currencies. // currencies.
Breadcrumbs::register( Breadcrumbs::register(
'currency.index', function(Generator $breadcrumbs) { 'currency.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.currencies'), route('currency.index')); $breadcrumbs->push(trans('breadcrumbs.currencies'), route('currency.index'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'currency.edit', function(Generator $breadcrumbs, TransactionCurrency $currency) { 'currency.edit', function (Generator $breadcrumbs, TransactionCurrency $currency) {
$breadcrumbs->parent('currency.index'); $breadcrumbs->parent('currency.index');
$breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currency.edit', [$currency->id])); $breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currency.edit', [$currency->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'currency.delete', function(Generator $breadcrumbs, TransactionCurrency $currency) { 'currency.delete', function (Generator $breadcrumbs, TransactionCurrency $currency) {
$breadcrumbs->parent('currency.index'); $breadcrumbs->parent('currency.index');
$breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currency.delete', [$currency->id])); $breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currency.delete', [$currency->id]));
} }
@@ -186,33 +186,33 @@ Breadcrumbs::register(
// piggy banks // piggy banks
Breadcrumbs::register( Breadcrumbs::register(
'piggy-banks.index', function(Generator $breadcrumbs) { 'piggy-banks.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.piggyBanks'), route('piggy-banks.index')); $breadcrumbs->push(trans('breadcrumbs.piggyBanks'), route('piggy-banks.index'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'piggy-banks.create', function(Generator $breadcrumbs) { 'piggy-banks.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('piggy-banks.index'); $breadcrumbs->parent('piggy-banks.index');
$breadcrumbs->push(trans('breadcrumbs.newPiggyBank'), route('piggy-banks.create')); $breadcrumbs->push(trans('breadcrumbs.newPiggyBank'), route('piggy-banks.create'));
} }
); );
Breadcrumbs::register( 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->parent('piggy-banks.show', $piggyBank);
$breadcrumbs->push(trans('breadcrumbs.edit_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.edit', [$piggyBank->id])); $breadcrumbs->push(trans('breadcrumbs.edit_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.edit', [$piggyBank->id]));
} }
); );
Breadcrumbs::register( 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->parent('piggy-banks.show', $piggyBank);
$breadcrumbs->push(trans('breadcrumbs.delete_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', [$piggyBank->id])); $breadcrumbs->push(trans('breadcrumbs.delete_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', [$piggyBank->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'piggy-banks.show', function(Generator $breadcrumbs, PiggyBank $piggyBank) { 'piggy-banks.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
$breadcrumbs->parent('piggy-banks.index'); $breadcrumbs->parent('piggy-banks.index');
$breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id])); $breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', [$piggyBank->id]));
@@ -221,7 +221,7 @@ Breadcrumbs::register(
// preferences // preferences
Breadcrumbs::register( Breadcrumbs::register(
'preferences', function(Generator $breadcrumbs) { 'preferences', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences')); $breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences'));
@@ -230,14 +230,14 @@ Breadcrumbs::register(
// profile // profile
Breadcrumbs::register( Breadcrumbs::register(
'profile', function(Generator $breadcrumbs) { 'profile', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.profile'), route('profile')); $breadcrumbs->push(trans('breadcrumbs.profile'), route('profile'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'change-password', function(Generator $breadcrumbs) { 'change-password', function (Generator $breadcrumbs) {
$breadcrumbs->parent('profile'); $breadcrumbs->parent('profile');
$breadcrumbs->push(trans('breadcrumbs.changePassword'), route('change-password')); $breadcrumbs->push(trans('breadcrumbs.changePassword'), route('change-password'));
@@ -246,33 +246,33 @@ Breadcrumbs::register(
// bills // bills
Breadcrumbs::register( Breadcrumbs::register(
'bills.index', function(Generator $breadcrumbs) { 'bills.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.bills'), route('bills.index')); $breadcrumbs->push(trans('breadcrumbs.bills'), route('bills.index'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'bills.create', function(Generator $breadcrumbs) { 'bills.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('bills.index'); $breadcrumbs->parent('bills.index');
$breadcrumbs->push(trans('breadcrumbs.newBill'), route('bills.create')); $breadcrumbs->push(trans('breadcrumbs.newBill'), route('bills.create'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'bills.edit', function(Generator $breadcrumbs, Bill $bill) { 'bills.edit', function (Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.show', $bill); $breadcrumbs->parent('bills.show', $bill);
$breadcrumbs->push(trans('breadcrumbs.edit_bill', ['name' => e($bill->name)]), route('bills.edit', [$bill->id])); $breadcrumbs->push(trans('breadcrumbs.edit_bill', ['name' => e($bill->name)]), route('bills.edit', [$bill->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'bills.delete', function(Generator $breadcrumbs, Bill $bill) { 'bills.delete', function (Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.show', $bill); $breadcrumbs->parent('bills.show', $bill);
$breadcrumbs->push(trans('breadcrumbs.delete_bill', ['name' => e($bill->name)]), route('bills.delete', [$bill->id])); $breadcrumbs->push(trans('breadcrumbs.delete_bill', ['name' => e($bill->name)]), route('bills.delete', [$bill->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'bills.show', function(Generator $breadcrumbs, Bill $bill) { 'bills.show', function (Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.index'); $breadcrumbs->parent('bills.index');
$breadcrumbs->push(e($bill->name), route('bills.show', [$bill->id])); $breadcrumbs->push(e($bill->name), route('bills.show', [$bill->id]));
@@ -281,7 +281,7 @@ Breadcrumbs::register(
// reminders // reminders
Breadcrumbs::register( Breadcrumbs::register(
'reminders.index', function(Generator $breadcrumbs) { 'reminders.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.reminders'), route('reminders.index')); $breadcrumbs->push(trans('breadcrumbs.reminders'), route('reminders.index'));
@@ -290,7 +290,7 @@ Breadcrumbs::register(
// reminders // reminders
Breadcrumbs::register( Breadcrumbs::register(
'reminders.show', function(Generator $breadcrumbs, Reminder $reminder) { 'reminders.show', function (Generator $breadcrumbs, Reminder $reminder) {
$breadcrumbs->parent('reminders.index'); $breadcrumbs->parent('reminders.index');
$breadcrumbs->push(trans('breadcrumbs.reminder', ['id' => e($reminder->id)]), route('reminders.show', [$reminder->id])); $breadcrumbs->push(trans('breadcrumbs.reminder', ['id' => e($reminder->id)]), route('reminders.show', [$reminder->id]));
@@ -300,14 +300,14 @@ Breadcrumbs::register(
// reports // reports
Breadcrumbs::register( Breadcrumbs::register(
'reports.index', function(Generator $breadcrumbs) { 'reports.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index')); $breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'reports.year', function(Generator $breadcrumbs, Carbon $date, $shared) { 'reports.year', function (Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.index'); $breadcrumbs->parent('reports.index');
if ($shared) { if ($shared) {
$title = trans('breadcrumbs.yearly_report_shared', ['date' => $date->year]); $title = trans('breadcrumbs.yearly_report_shared', ['date' => $date->year]);
@@ -319,7 +319,7 @@ Breadcrumbs::register(
); );
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); $breadcrumbs->parent('reports.year', $date, $shared);
if ($shared) { if ($shared) {
@@ -334,7 +334,7 @@ Breadcrumbs::register(
// search // search
Breadcrumbs::register( Breadcrumbs::register(
'search', function(Generator $breadcrumbs, $query) { 'search', function (Generator $breadcrumbs, $query) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search')); $breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search'));
} }
@@ -342,33 +342,33 @@ Breadcrumbs::register(
// transactions // transactions
Breadcrumbs::register( Breadcrumbs::register(
'transactions.index', function(Generator $breadcrumbs, $what) { 'transactions.index', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what])); $breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'transactions.create', function(Generator $breadcrumbs, $what) { 'transactions.create', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('transactions.index', $what); $breadcrumbs->parent('transactions.index', $what);
$breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', [$what])); $breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', [$what]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'transactions.edit', function(Generator $breadcrumbs, TransactionJournal $journal) { 'transactions.edit', function (Generator $breadcrumbs, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.show', $journal); $breadcrumbs->parent('transactions.show', $journal);
$breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.edit', [$journal->id])); $breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.edit', [$journal->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'transactions.delete', function(Generator $breadcrumbs, TransactionJournal $journal) { 'transactions.delete', function (Generator $breadcrumbs, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.show', $journal); $breadcrumbs->parent('transactions.show', $journal);
$breadcrumbs->push(trans('breadcrumbs.delete_journal', ['description' => e($journal->description)]), route('transactions.delete', [$journal->id])); $breadcrumbs->push(trans('breadcrumbs.delete_journal', ['description' => e($journal->description)]), route('transactions.delete', [$journal->id]));
} }
); );
Breadcrumbs::register( 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->parent('transactions.index', strtolower($journal->transactionType->type));
$breadcrumbs->push($journal->description, route('transactions.show', [$journal->id])); $breadcrumbs->push($journal->description, route('transactions.show', [$journal->id]));
@@ -378,28 +378,28 @@ Breadcrumbs::register(
// tags // tags
Breadcrumbs::register( Breadcrumbs::register(
'tags.index', function(Generator $breadcrumbs) { 'tags.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.tags'), route('tags.index')); $breadcrumbs->push(trans('breadcrumbs.tags'), route('tags.index'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'tags.create', function(Generator $breadcrumbs) { 'tags.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('tags.index'); $breadcrumbs->parent('tags.index');
$breadcrumbs->push(trans('breadcrumbs.createTag'), route('tags.create')); $breadcrumbs->push(trans('breadcrumbs.createTag'), route('tags.create'));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'tags.edit', function(Generator $breadcrumbs, Tag $tag) { 'tags.edit', function (Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag); $breadcrumbs->parent('tags.show', $tag);
$breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', [$tag->id])); $breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', [$tag->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'tags.delete', function(Generator $breadcrumbs, Tag $tag) { 'tags.delete', function (Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag); $breadcrumbs->parent('tags.show', $tag);
$breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', [$tag->id])); $breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', [$tag->id]));
} }
@@ -407,7 +407,7 @@ Breadcrumbs::register(
Breadcrumbs::register( Breadcrumbs::register(
'tags.show', function(Generator $breadcrumbs, Tag $tag) { 'tags.show', function (Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.index'); $breadcrumbs->parent('tags.index');
$breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id])); $breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id]));
} }

View File

@@ -11,22 +11,22 @@ use Watson\Validating\ValidatingTrait;
* Class Account * Class Account
* *
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property integer $user_id * @property integer $user_id
* @property integer $account_type_id * @property integer $account_type_id
* @property string $name * @property string $name
* @property boolean $active * @property boolean $active
* @property boolean $encrypted * @property boolean $encrypted
* @property float $virtual_balance * @property float $virtual_balance
* @property string $virtual_balance_encrypted * @property string $virtual_balance_encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
* @property-read \FireflyIII\Models\AccountType $accountType * @property-read \FireflyIII\Models\AccountType $accountType
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
* @property-read \FireflyIII\User $user * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereUpdatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereUpdatedAt($value)
@@ -40,12 +40,12 @@ use Watson\Validating\ValidatingTrait;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereVirtualBalanceEncrypted($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account whereVirtualBalanceEncrypted($value)
* @method static \FireflyIII\Models\Account accountTypeIn($types) * @method static \FireflyIII\Models\Account accountTypeIn($types)
* @method static \FireflyIII\Models\Account hasMetaValue($name, $value) * @method static \FireflyIII\Models\Account hasMetaValue($name, $value)
* @property boolean joinedAccountTypes * @property boolean joinedAccountTypes
* @property mixed startBalance * @property mixed startBalance
* @property mixed endBalance * @property mixed endBalance
* @property mixed lastActivityDate * @property mixed lastActivityDate
* @property mixed piggyBalance * @property mixed piggyBalance
* @property mixed difference * @property mixed difference
* @propery mixed percentage * @propery mixed percentage
* *
*/ */
@@ -216,7 +216,7 @@ class Account extends Model
{ {
$joinName = str_replace('.', '_', $name); $joinName = str_replace('.', '_', $name);
$query->leftJoin( $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); $join->on($joinName . '.account_id', '=', 'accounts.id')->where($joinName . '.name', '=', $name);
} }
); );

View File

@@ -6,14 +6,14 @@ use Watson\Validating\ValidatingTrait;
/** /**
* Class AccountMeta * Class AccountMeta
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property integer $account_id * @property integer $account_id
* @property string $name * @property string $name
* @property string $data * @property string $data
* @property-read \FireflyIII\Models\Account $account * @property-read \FireflyIII\Models\Account $account
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountMeta whereCreatedAt($value)
@@ -33,7 +33,7 @@ class AccountMeta extends Model
'name' => 'required|between:1,100', 'name' => 'required|between:1,100',
'data' => 'required' 'data' => 'required'
]; ];
protected $table = 'account_meta'; protected $table = 'account_meta';
/** /**
* *

View File

@@ -5,13 +5,13 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* Class AccountType * Class AccountType
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property string $type * @property string $type
* @property boolean $editable * @property boolean $editable
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\AccountType whereCreatedAt($value)

View File

@@ -7,26 +7,26 @@ use Illuminate\Database\Eloquent\Model;
* FireflyIII\Models\Bill * FireflyIII\Models\Bill
* *
* @codeCoverageIgnore Class Bill * @codeCoverageIgnore Class Bill
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property integer $user_id * @property integer $user_id
* @property string $name * @property string $name
* @property string $match * @property string $match
* @property float $amount_min * @property float $amount_min
* @property string $amount_min_encrypted * @property string $amount_min_encrypted
* @property float $amount_max * @property float $amount_max
* @property string $amount_max_encrypted * @property string $amount_max_encrypted
* @property \Carbon\Carbon $date * @property \Carbon\Carbon $date
* @property boolean $active * @property boolean $active
* @property boolean $automatch * @property boolean $automatch
* @property string $repeat_freq * @property string $repeat_freq
* @property integer $skip * @property integer $skip
* @property boolean $name_encrypted * @property boolean $name_encrypted
* @property boolean $match_encrypted * @property boolean $match_encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUpdatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereUpdatedAt($value)
@@ -44,14 +44,14 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereSkip($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereSkip($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereNameEncrypted($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereNameEncrypted($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatchEncrypted($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Bill whereMatchEncrypted($value)
* @property mixed nextExpectedMatch * @property mixed nextExpectedMatch
* @property mixed lastFoundMatch * @property mixed lastFoundMatch
*/ */
class Bill extends Model class Bill extends Model
{ {
protected $fillable 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']; protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];

View File

@@ -7,19 +7,19 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class Budget * Class Budget
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property string $name * @property string $name
* @property integer $user_id * @property integer $user_id
* @property boolean $active * @property boolean $active
* @property boolean $encrypted * @property boolean $encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUpdatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Budget whereUpdatedAt($value)

View File

@@ -5,18 +5,18 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* Class BudgetLimit * Class BudgetLimit
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property integer $budget_id * @property integer $budget_id
* @property \Carbon\Carbon $startdate * @property \Carbon\Carbon $startdate
* @property float $amount * @property float $amount
* @property string $amount_encrypted * @property string $amount_encrypted
* @property boolean $repeats * @property boolean $repeats
* @property string $repeat_freq * @property string $repeat_freq
* @property-read \FireflyIII\Models\Budget $budget * @property-read \FireflyIII\Models\Budget $budget
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\LimitRepetition[] $limitrepetitions
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\BudgetLimit whereCreatedAt($value)

View File

@@ -8,15 +8,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* Class Category * Class Category
* *
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property string $name * @property string $name
* @property integer $user_id * @property integer $user_id
* @property boolean $encrypted * @property boolean $encrypted
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUpdatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUpdatedAt($value)
@@ -24,8 +24,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereName($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereName($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUserId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereEncrypted($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Category whereEncrypted($value)
* @property mixed spent * @property mixed spent
* @property mixed lastActivity * @property mixed lastActivity
*/ */
class Category extends Model class Category extends Model
{ {

View File

@@ -6,15 +6,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class Component * Class Component
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property string $name * @property string $name
* @property integer $user_id * @property integer $user_id
* @property string $class * @property string $class
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereUpdatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Component whereUpdatedAt($value)

View File

@@ -5,16 +5,16 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* Class LimitRepetition * Class LimitRepetition
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property integer $budget_limit_id * @property integer $budget_limit_id
* @property \Carbon\Carbon $startdate * @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $enddate * @property \Carbon\Carbon $enddate
* @property float $amount * @property float $amount
* @property string $amount_encrypted * @property string $amount_encrypted
* @property-read \FireflyIII\Models\BudgetLimit $budgetLimit * @property-read \FireflyIII\Models\BudgetLimit $budgetLimit
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereCreatedAt($value)

View File

@@ -7,27 +7,27 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class PiggyBank * Class PiggyBank
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property integer $account_id * @property integer $account_id
* @property string $name * @property string $name
* @property float $targetamount * @property float $targetamount
* @property string $targetamount_encrypted * @property string $targetamount_encrypted
* @property \Carbon\Carbon $startdate * @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $targetdate * @property \Carbon\Carbon $targetdate
* @property string $reminder * @property string $reminder
* @property integer $reminder_skip * @property integer $reminder_skip
* @property boolean $remind_me * @property boolean $remind_me
* @property integer $order * @property integer $order
* @property boolean $encrypted * @property boolean $encrypted
* @property-read \FireflyIII\Models\Account $account * @property-read \FireflyIII\Models\Account $account
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankRepetition[] $piggyBankRepetitions * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankRepetition[] $piggyBankRepetitions
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBankEvent[] $piggyBankEvents
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereUpdatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereUpdatedAt($value)
@@ -43,14 +43,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereRemindMe($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereRemindMe($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereOrder($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereOrder($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereEncrypted($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBank whereEncrypted($value)
* @property PiggyBankRepetition currentRep * @property PiggyBankRepetition currentRep
*/ */
class PiggyBank extends Model class PiggyBank extends Model
{ {
use SoftDeletes; use SoftDeletes;
protected $fillable 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']; protected $hidden = ['targetamount_encrypted', 'encrypted'];
/** /**

View File

@@ -5,17 +5,17 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* Class PiggyBankEvent * Class PiggyBankEvent
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property integer $piggy_bank_id * @property integer $piggy_bank_id
* @property integer $transaction_journal_id * @property integer $transaction_journal_id
* @property \Carbon\Carbon $date * @property \Carbon\Carbon $date
* @property float $amount * @property float $amount
* @property string $amount_encrypted * @property string $amount_encrypted
* @property-read \FireflyIII\Models\PiggyBank $piggyBank * @property-read \FireflyIII\Models\PiggyBank $piggyBank
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal * @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value)

View File

@@ -7,16 +7,16 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* Class PiggyBankRepetition * Class PiggyBankRepetition
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property integer $piggy_bank_id * @property integer $piggy_bank_id
* @property \Carbon\Carbon $startdate * @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $targetdate * @property \Carbon\Carbon $targetdate
* @property float $currentamount * @property float $currentamount
* @property string $currentamount_encrypted * @property string $currentamount_encrypted
* @property-read \FireflyIII\Models\PiggyBank $piggyBank * @property-read \FireflyIII\Models\PiggyBank $piggyBank
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankRepetition whereCreatedAt($value)
@@ -77,13 +77,13 @@ class PiggyBankRepetition extends Model
$q->orWhereNull('startdate'); $q->orWhereNull('startdate');
} }
) )
->where( ->where(
function (EloquentBuilder $q) use ($date) { function (EloquentBuilder $q) use ($date) {
$q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00')); $q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));
$q->orWhereNull('targetdate'); $q->orWhereNull('targetdate');
} }
); );
} }
/** /**

View File

@@ -6,16 +6,16 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* Class Preference * Class Preference
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property integer $user_id * @property integer $user_id
* @property string $name * @property string $name
* @property string $name_encrypted * @property string $name_encrypted
* @property string $data * @property string $data
* @property string $data_encrypted * @property string $data_encrypted
* @property-read \FireflyIII\User $user * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Preference whereCreatedAt($value)

View File

@@ -8,21 +8,21 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* Class Reminder * Class Reminder
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property integer $user_id * @property integer $user_id
* @property \Carbon\Carbon $startdate * @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $enddate * @property \Carbon\Carbon $enddate
* @property boolean $active * @property boolean $active
* @property boolean $notnow * @property boolean $notnow
* @property integer $remindersable_id * @property integer $remindersable_id
* @property string $remindersable_type * @property string $remindersable_type
* @property string $metadata * @property string $metadata
* @property boolean $encrypted * @property boolean $encrypted
* @property-read \ $remindersable * @property-read \ $remindersable
* @property-read \FireflyIII\User $user * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereCreatedAt($value)
@@ -38,13 +38,13 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereEncrypted($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Reminder whereEncrypted($value)
* @method static \FireflyIII\Models\Reminder onDates($start, $end) * @method static \FireflyIII\Models\Reminder onDates($start, $end)
* @method static \FireflyIII\Models\Reminder today() * @method static \FireflyIII\Models\Reminder today()
* @property string description * @property string description
*/ */
class Reminder extends Model 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']; protected $hidden = ['encrypted'];
/** /**
@@ -124,7 +124,7 @@ class Reminder extends Model
$today = new Carbon; $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) 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);
} }
/** /**

View File

@@ -10,20 +10,20 @@ use Watson\Validating\ValidatingTrait;
* Class Tag * Class Tag
* *
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property string $deleted_at * @property string $deleted_at
* @property integer $user_id * @property integer $user_id
* @property string $tag * @property string $tag
* @property string $tagMode * @property string $tagMode
* @property \Carbon\Carbon $date * @property \Carbon\Carbon $date
* @property string $description * @property string $description
* @property float $latitude * @property float $latitude
* @property float $longitude * @property float $longitude
* @property integer $zoomLevel * @property integer $zoomLevel
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereUpdatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Tag whereUpdatedAt($value)

View File

@@ -9,18 +9,18 @@ use Watson\Validating\ValidatingTrait;
/** /**
* Class Transaction * Class Transaction
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property integer $account_id * @property integer $account_id
* @property integer $transaction_journal_id * @property integer $transaction_journal_id
* @property string $description * @property string $description
* @property float $amount * @property float $amount
* @property string $amount_encrypted * @property string $amount_encrypted
* @property-read \FireflyIII\Models\Account $account * @property-read \FireflyIII\Models\Account $account
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal * @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereCreatedAt($value)
@@ -33,8 +33,8 @@ use Watson\Validating\ValidatingTrait;
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAmountEncrypted($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Transaction whereAmountEncrypted($value)
* @method static \FireflyIII\Models\Transaction after($date) * @method static \FireflyIII\Models\Transaction after($date)
* @method static \FireflyIII\Models\Transaction before($date) * @method static \FireflyIII\Models\Transaction before($date)
* @property mixed before * @property mixed before
* @property mixed after * @property mixed after
*/ */
class Transaction extends Model class Transaction extends Model
{ {

View File

@@ -6,15 +6,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class TransactionCurrency * Class TransactionCurrency
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property string $code * @property string $code
* @property string $name * @property string $name
* @property string $symbol * @property string $symbol
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionCurrency whereCreatedAt($value)

View File

@@ -6,16 +6,16 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class TransactionGroup * Class TransactionGroup
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property integer $user_id * @property integer $user_id
* @property string $relation * @property string $relation
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @property-read \FireflyIII\User $user * @property-read \FireflyIII\User $user
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereUpdatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionGroup whereUpdatedAt($value)

View File

@@ -1,6 +1,5 @@
<?php namespace FireflyIII\Models; <?php namespace FireflyIII\Models;
use Cache;
use Carbon\Carbon; use Carbon\Carbon;
use Crypt; use Crypt;
use FireflyIII\Support\CacheProperties; use FireflyIII\Support\CacheProperties;
@@ -136,13 +135,12 @@ class TransactionJournal extends Model
*/ */
public function getAmountAttribute() public function getAmountAttribute()
{ {
$prop = new CacheProperties(); $cache = new CacheProperties();
$prop->addProperty($this->id); $cache->addProperty($this->id);
$prop->addProperty('amount'); $cache->addProperty('amount');
if ($prop->has()) { if ($cache->has()) {
return $prop->get(); return $cache->get();
} }
$md5 = $prop->getMd5();
$amount = '0'; $amount = '0';
@@ -158,7 +156,7 @@ class TransactionJournal extends Model
* If the journal has tags, it gets complicated. * If the journal has tags, it gets complicated.
*/ */
if ($this->tags->count() == 0) { if ($this->tags->count() == 0) {
Cache::forever($md5, $amount); $cache->store($amount);
return $amount; return $amount;
} }
@@ -173,7 +171,7 @@ class TransactionJournal extends Model
foreach ($others as $other) { foreach ($others as $other) {
$amount = bcsub($amount, $other->actual_amount); $amount = bcsub($amount, $other->actual_amount);
} }
Cache::forever($md5, $amount); $cache->store($amount);
return $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, // 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: // then the journal amount is correcting a withdrawal, and the amount is zero:
if ($advancePayment && $this->transactionType->type == 'Deposit') { if ($advancePayment && $this->transactionType->type == 'Deposit') {
Cache::forever($md5, '0'); $cache->store('0');
return '0'; return '0';
} }
@@ -196,14 +194,14 @@ class TransactionJournal extends Model
$transfer = $balancingAct->transactionJournals()->transactionTypes(['Transfer'])->first(); $transfer = $balancingAct->transactionJournals()->transactionTypes(['Transfer'])->first();
if ($transfer) { if ($transfer) {
$amount = bcsub($amount, $transfer->actual_amount); $amount = bcsub($amount, $transfer->actual_amount);
Cache::forever($md5, $amount); $cache->store($amount);
return $amount; return $amount;
} }
} // @codeCoverageIgnore } // @codeCoverageIgnore
} // @codeCoverageIgnore } // @codeCoverageIgnore
Cache::forever($md5, $amount); $cache->store($amount);
return $amount; return $amount;
} }

View File

@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
/** /**
* Class TransactionRelation * Class TransactionRelation
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
*/ */
class TransactionRelation extends Model class TransactionRelation extends Model

View File

@@ -6,13 +6,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class TransactionType * Class TransactionType
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @package FireflyIII\Models * @package FireflyIII\Models
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
* @property string $type * @property string $type
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionType whereCreatedAt($value)

View File

@@ -23,7 +23,7 @@ class BusServiceProvider extends ServiceProvider
public function boot(Dispatcher $dispatcher) public function boot(Dispatcher $dispatcher)
{ {
$dispatcher->mapUsing( $dispatcher->mapUsing(
function($command) { function ($command) {
return Dispatcher::simpleMapping( return Dispatcher::simpleMapping(
$command, 'FireflyIII\Commands', 'FireflyIII\Handlers\Commands' $command, 'FireflyIII\Commands', 'FireflyIII\Handlers\Commands'
); );

View File

@@ -52,12 +52,12 @@ class EventServiceProvider extends ServiceProvider
$this->registerDeleteEvents(); $this->registerDeleteEvents();
$this->registerCreateEvents(); $this->registerCreateEvents();
BudgetLimit::saved( BudgetLimit::saved(
function(BudgetLimit $budgetLimit) { function (BudgetLimit $budgetLimit) {
$end = Navigation::addPeriod(clone $budgetLimit->startdate, $budgetLimit->repeat_freq, 0); $end = Navigation::addPeriod(clone $budgetLimit->startdate, $budgetLimit->repeat_freq, 0);
$end->subDay(); $end->subDay();
$set = $budgetLimit->limitrepetitions()->where('startdate', $budgetLimit->startdate->format('Y-m-d'))->where('enddate', $end->format('Y-m-d')) $set = $budgetLimit->limitrepetitions()->where('startdate', $budgetLimit->startdate->format('Y-m-d'))->where('enddate', $end->format('Y-m-d'))
->get(); ->get();
if ($set->count() == 0) { if ($set->count() == 0) {
$repetition = new LimitRepetition; $repetition = new LimitRepetition;
$repetition->startdate = $budgetLimit->startdate; $repetition->startdate = $budgetLimit->startdate;
@@ -91,7 +91,7 @@ class EventServiceProvider extends ServiceProvider
protected function registerDeleteEvents() protected function registerDeleteEvents()
{ {
TransactionJournal::deleted( TransactionJournal::deleted(
function(TransactionJournal $journal) { function (TransactionJournal $journal) {
/** @var Transaction $transaction */ /** @var Transaction $transaction */
foreach ($journal->transactions()->get() as $transaction) { foreach ($journal->transactions()->get() as $transaction) {
@@ -100,7 +100,7 @@ class EventServiceProvider extends ServiceProvider
} }
); );
PiggyBank::deleting( PiggyBank::deleting(
function(PiggyBank $piggyBank) { function (PiggyBank $piggyBank) {
$reminders = $piggyBank->reminders()->get(); $reminders = $piggyBank->reminders()->get();
/** @var Reminder $reminder */ /** @var Reminder $reminder */
foreach ($reminders as $reminder) { foreach ($reminders as $reminder) {
@@ -110,7 +110,7 @@ class EventServiceProvider extends ServiceProvider
); );
Account::deleted( Account::deleted(
function(Account $account) { function (Account $account) {
/** @var Transaction $transaction */ /** @var Transaction $transaction */
foreach ($account->transactions()->get() as $transaction) { foreach ($account->transactions()->get() as $transaction) {
@@ -131,7 +131,7 @@ class EventServiceProvider extends ServiceProvider
// move this routine to a filter // move this routine to a filter
// in case of repeated piggy banks and/or other problems. // in case of repeated piggy banks and/or other problems.
PiggyBank::created( PiggyBank::created(
function(PiggyBank $piggyBank) { function (PiggyBank $piggyBank) {
$repetition = new PiggyBankRepetition; $repetition = new PiggyBankRepetition;
$repetition->piggyBank()->associate($piggyBank); $repetition->piggyBank()->associate($piggyBank);
$repetition->startdate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate; $repetition->startdate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate;

View File

@@ -30,7 +30,7 @@ class FireflyServiceProvider extends ServiceProvider
public function boot() public function boot()
{ {
Validator::resolver( Validator::resolver(
function($translator, $data, $rules, $messages) { function ($translator, $data, $rules, $messages) {
return new FireflyValidator($translator, $data, $rules, $messages); return new FireflyValidator($translator, $data, $rules, $messages);
} }
); );
@@ -55,28 +55,28 @@ class FireflyServiceProvider extends ServiceProvider
$this->app->bind( $this->app->bind(
'preferences', function() { 'preferences', function () {
return new Preferences; return new Preferences;
} }
); );
$this->app->bind( $this->app->bind(
'navigation', function() { 'navigation', function () {
return new Navigation; return new Navigation;
} }
); );
$this->app->bind( $this->app->bind(
'amount', function() { 'amount', function () {
return new Amount; return new Amount;
} }
); );
$this->app->bind( $this->app->bind(
'steam', function() { 'steam', function () {
return new Steam; return new Steam;
} }
); );
$this->app->bind( $this->app->bind(
'expandedform', function() { 'expandedform', function () {
return new ExpandedForm; return new ExpandedForm;
} }
); );

View File

@@ -44,7 +44,7 @@ class RouteServiceProvider extends ServiceProvider
public function map(Router $router) public function map(Router $router)
{ {
$router->group( $router->group(
['namespace' => $this->namespace], function($router) { ['namespace' => $this->namespace], function ($router) {
/** @noinspection PhpIncludeInspection */ /** @noinspection PhpIncludeInspection */
require app_path('Http/routes.php'); require app_path('Http/routes.php');
} }

View File

@@ -4,7 +4,6 @@ namespace FireflyIII\Repositories\Account;
use App; use App;
use Auth; use Auth;
use Cache;
use Carbon\Carbon; use Carbon\Carbon;
use Config; use Config;
use DB; use DB;
@@ -117,7 +116,6 @@ class AccountRepository implements AccountRepositoryInterface
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
$md5 = $cache->getMd5();
if ($preference->data == []) { 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.*']); $accounts = Auth::user()->accounts()->whereIn('id', $preference->data)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
} }
Cache::forever($md5, $accounts); $cache->store($accounts);
return $accounts; return $accounts;
} }
@@ -144,14 +142,13 @@ class AccountRepository implements AccountRepositoryInterface
*/ */
public function getFrontpageTransactions(Account $account, Carbon $start, Carbon $end) public function getFrontpageTransactions(Account $account, Carbon $start, Carbon $end)
{ {
$prop = new CacheProperties(); $cache = new CacheProperties();
$prop->addProperty($account->id); $cache->addProperty($account->id);
$prop->addProperty($start); $cache->addProperty($start);
$prop->addProperty($end); $cache->addProperty($end);
if ($prop->has()) { if ($cache->has()) {
return $prop->get(); return $cache->get();
} }
$md5 = $prop->getMd5();
$set = Auth::user() $set = Auth::user()
->transactionjournals() ->transactionjournals()
@@ -166,7 +163,7 @@ class AccountRepository implements AccountRepositoryInterface
->orderBy('transaction_journals.id', 'DESC') ->orderBy('transaction_journals.id', 'DESC')
->take(10) ->take(10)
->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']); ->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);
Cache::forever($md5, $set); $cache->store($set);
return $set; return $set;
} }
@@ -238,7 +235,6 @@ class AccountRepository implements AccountRepositoryInterface
if ($cache->has()) { if ($cache->has()) {
return $cache->get(); return $cache->get();
} }
$md5 = $cache->getMd5();
$ids = array_unique($ids); $ids = array_unique($ids);
if (count($ids) > 0) { if (count($ids) > 0) {
@@ -264,7 +260,7 @@ class AccountRepository implements AccountRepositoryInterface
} }
); );
Cache::forever($md5, $accounts); $cache->store($accounts);
return $accounts; return $accounts;

View File

@@ -79,10 +79,10 @@ class BudgetRepository implements BudgetRepositoryInterface
/** @var Collection $repetitions */ /** @var Collection $repetitions */
return LimitRepetition:: return LimitRepetition::
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') 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', '<=', $end->format('Y-m-d 00:00:00'))
->where('limit_repetitions.startdate', '>=', $start->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) ->where('budget_limits.budget_id', $budget->id)
->get(['limit_repetitions.*']); ->get(['limit_repetitions.*']);
} }
/** /**
@@ -154,9 +154,9 @@ class BudgetRepository implements BudgetRepositoryInterface
$setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset) $setQuery = $budget->transactionJournals()->withRelevantData()->take($take)->offset($offset)
->orderBy('transaction_journals.date', 'DESC') ->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC') ->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC'); ->orderBy('transaction_journals.id', 'DESC');
$countQuery = $budget->transactionJournals(); $countQuery = $budget->transactionJournals();
@@ -196,9 +196,9 @@ class BudgetRepository implements BudgetRepositoryInterface
public function getLimitAmountOnDate(Budget $budget, Carbon $date) public function getLimitAmountOnDate(Budget $budget, Carbon $date)
{ {
$repetition = LimitRepetition::leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') $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('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
->where('budget_limits.budget_id', $budget->id) ->where('budget_limits.budget_id', $budget->id)
->first(['limit_repetitions.*']); ->first(['limit_repetitions.*']);
if ($repetition) { if ($repetition) {
return floatval($repetition->amount); return floatval($repetition->amount);
@@ -216,15 +216,15 @@ class BudgetRepository implements BudgetRepositoryInterface
public function getWithoutBudget(Carbon $start, Carbon $end) public function getWithoutBudget(Carbon $start, Carbon $end)
{ {
return Auth::user() return Auth::user()
->transactionjournals() ->transactionjournals()
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->whereNull('budget_transaction_journal.id') ->whereNull('budget_transaction_journal.id')
->before($end) ->before($end)
->after($start) ->after($start)
->orderBy('transaction_journals.date', 'DESC') ->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC') ->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC') ->orderBy('transaction_journals.id', 'DESC')
->get(['transaction_journals.*']); ->get(['transaction_journals.*']);
} }
/** /**
@@ -236,22 +236,22 @@ class BudgetRepository implements BudgetRepositoryInterface
public function getWithoutBudgetSum(Carbon $start, Carbon $end) public function getWithoutBudgetSum(Carbon $start, Carbon $end)
{ {
$noBudgetSet = Auth::user() $noBudgetSet = Auth::user()
->transactionjournals() ->transactionjournals()
->whereNotIn( ->whereNotIn(
'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) { 'transaction_journals.id', function (QueryBuilder $query) use ($start, $end) {
$query $query
->select('transaction_journals.id') ->select('transaction_journals.id')
->from('transaction_journals') ->from('transaction_journals')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') ->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', '>=', $start->format('Y-m-d 00:00:00'))
->where('transaction_journals.date', '<=', $end->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'); ->whereNotNull('budget_transaction_journal.budget_id');
} }
) )
->after($start) ->after($start)
->before($end) ->before($end)
->transactionTypes(['Withdrawal']) ->transactionTypes(['Withdrawal'])
->get(['transaction_journals.*'])->sum('amount'); ->get(['transaction_journals.*'])->sum('amount');
return floatval($noBudgetSet) * -1; return floatval($noBudgetSet) * -1;
} }
@@ -272,18 +272,18 @@ class BudgetRepository implements BudgetRepositoryInterface
} else { } else {
// get all journals in this month where the asset account is NOT shared. // get all journals in this month where the asset account is NOT shared.
$sum = $budget->transactionjournals() $sum = $budget->transactionjournals()
->before($end) ->before($end)
->after($start) ->after($start)
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin( ->leftJoin(
'account_meta', function (JoinClause $join) { 'account_meta', function (JoinClause $join) {
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
} }
) )
->where('account_meta.data', '!=', '"sharedAsset"') ->where('account_meta.data', '!=', '"sharedAsset"')
->get(['transaction_journals.*']) ->get(['transaction_journals.*'])
->sum('amount'); ->sum('amount');
$sum = floatval($sum); $sum = floatval($sum);
} }

View File

@@ -49,7 +49,7 @@ class CategoryRepository implements CategoryRepositoryInterface
/** @var Collection $set */ /** @var Collection $set */
$set = Auth::user()->categories()->orderBy('name', 'ASC')->get(); $set = Auth::user()->categories()->orderBy('name', 'ASC')->get();
$set->sortBy( $set->sortBy(
function(Category $category) { function (Category $category) {
return $category->name; return $category->name;
} }
); );
@@ -67,16 +67,16 @@ class CategoryRepository implements CategoryRepositoryInterface
public function getCategoriesAndExpensesCorrected($start, $end) public function getCategoriesAndExpensesCorrected($start, $end)
{ {
$set = Auth::user()->transactionjournals() $set = Auth::user()->transactionjournals()
->leftJoin( ->leftJoin(
'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id' 'category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
) )
->leftJoin('categories', 'categories.id', '=', 'category_transaction_journal.category_id') ->leftJoin('categories', 'categories.id', '=', 'category_transaction_journal.category_id')
->before($end) ->before($end)
->where('categories.user_id', Auth::user()->id) ->where('categories.user_id', Auth::user()->id)
->after($start) ->after($start)
->transactionTypes(['Withdrawal']) ->transactionTypes(['Withdrawal'])
->groupBy('categories.id') ->groupBy('categories.id')
->get(['categories.id as category_id', 'categories.encrypted as category_encrypted', 'categories.name', 'transaction_journals.*']); ->get(['categories.id as category_id', 'categories.encrypted as category_encrypted', 'categories.name', 'transaction_journals.*']);
$result = []; $result = [];
foreach ($set as $entry) { foreach ($set as $entry) {
@@ -143,10 +143,10 @@ class CategoryRepository implements CategoryRepositoryInterface
public function getLatestActivity(Category $category) public function getLatestActivity(Category $category)
{ {
$latest = $category->transactionjournals() $latest = $category->transactionjournals()
->orderBy('transaction_journals.date', 'DESC') ->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC') ->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC') ->orderBy('transaction_journals.id', 'DESC')
->first(); ->first();
if ($latest) { if ($latest) {
return $latest->date; return $latest->date;
} }
@@ -163,15 +163,15 @@ class CategoryRepository implements CategoryRepositoryInterface
public function getWithoutCategory(Carbon $start, Carbon $end) public function getWithoutCategory(Carbon $start, Carbon $end)
{ {
return Auth::user() return Auth::user()
->transactionjournals() ->transactionjournals()
->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->whereNull('category_transaction_journal.id') ->whereNull('category_transaction_journal.id')
->before($end) ->before($end)
->after($start) ->after($start)
->orderBy('transaction_journals.date', 'DESC') ->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC') ->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC') ->orderBy('transaction_journals.id', 'DESC')
->get(['transaction_journals.*']); ->get(['transaction_journals.*']);
} }
/** /**
@@ -190,8 +190,8 @@ class CategoryRepository implements CategoryRepositoryInterface
// always ignore transfers between accounts! // always ignore transfers between accounts!
$sum = floatval( $sum = floatval(
$category->transactionjournals() $category->transactionjournals()
->transactionTypes(['Withdrawal']) ->transactionTypes(['Withdrawal'])
->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount') ->before($end)->after($start)->get(['transaction_journals.*'])->sum('amount')
); );
} else { } else {
@@ -204,7 +204,7 @@ class CategoryRepository implements CategoryRepositoryInterface
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin( ->leftJoin(
'account_meta', function(JoinClause $join) { 'account_meta', function (JoinClause $join) {
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole'); $join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
} }
) )

View File

@@ -111,7 +111,7 @@ class JournalRepository implements JournalRepositoryInterface
*/ */
public function getJournalsOfTypes(array $types, $offset, $page) 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('date', 'DESC')
->orderBy('order', 'ASC') ->orderBy('order', 'ASC')
->orderBy('id', 'DESC') ->orderBy('id', 'DESC')

View File

@@ -102,7 +102,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
public function setOrder($id, $order) public function setOrder($id, $order)
{ {
$piggyBank = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('accounts.user_id', Auth::user()->id) $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) { if ($piggyBank) {
$piggyBank->order = $order; $piggyBank->order = $order;
$piggyBank->save(); $piggyBank->save();

View File

@@ -36,14 +36,14 @@ class ReminderRepository implements ReminderRepositoryInterface
$today = new Carbon; $today = new Carbon;
// active reminders: // active reminders:
$active = Auth::user()->reminders() $active = Auth::user()->reminders()
->where('notnow', 0) ->where('notnow', 0)
->where('active', 1) ->where('active', 1)
->where('startdate', '<=', $today->format('Y-m-d 00:00:00')) ->where('startdate', '<=', $today->format('Y-m-d 00:00:00'))
->where('enddate', '>=', $today->format('Y-m-d 00:00:00')) ->where('enddate', '>=', $today->format('Y-m-d 00:00:00'))
->get(); ->get();
$active->each( $active->each(
function(Reminder $reminder) { function (Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder); $reminder->description = $this->helper->getReminderText($reminder);
} }
); );
@@ -58,11 +58,11 @@ class ReminderRepository implements ReminderRepositoryInterface
public function getDismissedReminders() public function getDismissedReminders()
{ {
$dismissed = Auth::user()->reminders() $dismissed = Auth::user()->reminders()
->where('notnow', 1) ->where('notnow', 1)
->get(); ->get();
$dismissed->each( $dismissed->each(
function(Reminder $reminder) { function (Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder); $reminder->description = $this->helper->getReminderText($reminder);
} }
); );
@@ -77,18 +77,18 @@ class ReminderRepository implements ReminderRepositoryInterface
{ {
$expired = Auth::user()->reminders() $expired = Auth::user()->reminders()
->where('notnow', 0) ->where('notnow', 0)
->where('active', 1) ->where('active', 1)
->where( ->where(
function (Builder $q) { function (Builder $q) {
$today = new Carbon; $today = new Carbon;
$q->where('startdate', '>', $today->format('Y-m-d 00:00:00')); $q->where('startdate', '>', $today->format('Y-m-d 00:00:00'));
$q->orWhere('enddate', '<', $today->format('Y-m-d 00:00:00')); $q->orWhere('enddate', '<', $today->format('Y-m-d 00:00:00'));
} }
)->get(); )->get();
$expired->each( $expired->each(
function(Reminder $reminder) { function (Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder); $reminder->description = $this->helper->getReminderText($reminder);
} }
); );
@@ -106,7 +106,7 @@ class ReminderRepository implements ReminderRepositoryInterface
->get(); ->get();
$inactive->each( $inactive->each(
function(Reminder $reminder) { function (Reminder $reminder) {
$reminder->description = $this->helper->getReminderText($reminder); $reminder->description = $this->helper->getReminderText($reminder);
} }
); );

View File

@@ -109,7 +109,7 @@ class TagRepository implements TagRepositoryInterface
/** @var Collection $tags */ /** @var Collection $tags */
$tags = Auth::user()->tags()->get(); $tags = Auth::user()->tags()->get();
$tags->sortBy( $tags->sortBy(
function(Tag $tag) { function (Tag $tag) {
return $tag->tag; return $tag->tag;
} }
); );

View File

@@ -41,9 +41,9 @@ class Registrar implements RegistrarContract
{ {
return Validator::make( return Validator::make(
$data, [ $data, [
'email' => 'required|email|max:255|unique:users', 'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6', 'password' => 'required|confirmed|min:6',
] ]
); );
} }

View File

@@ -99,4 +99,12 @@ class CacheProperties
$this->md5 = md5($this->md5); $this->md5 = md5($this->md5);
} }
/**
* @param $data
*/
public function store($data)
{
Cache::forever($this->md5, $data);
}
} }

View File

@@ -118,7 +118,7 @@ class Navigation
'year' => 'endOfYear', 'year' => 'endOfYear',
'yearly' => 'endOfYear', 'yearly' => 'endOfYear',
]; ];
$specials = ['mont', 'monthly']; $specials = ['mont', 'monthly'];
$currentEnd = clone $theCurrentEnd; $currentEnd = clone $theCurrentEnd;
@@ -270,7 +270,7 @@ class Navigation
'3M' => 'lastOfQuarter', '3M' => 'lastOfQuarter',
'1Y' => 'endOfYear', '1Y' => 'endOfYear',
]; ];
$end = clone $start; $end = clone $start;
if (isset($functionMap[$range])) { if (isset($functionMap[$range])) {
$function = $functionMap[$range]; $function = $functionMap[$range];

View File

@@ -4,6 +4,7 @@ namespace FireflyIII\Support;
use Auth; use Auth;
use FireflyIII\Models\Preference; use FireflyIII\Models\Preference;
/** /**
* Class Preferences * Class Preferences
* *
@@ -21,14 +22,6 @@ class Preferences
return md5($preference); return md5($preference);
} }
/**
* @return bool
*/
public function mark() {
$this->set('lastActivity',microtime());
return true;
}
/** /**
* @param $name * @param $name
* @param null $default * @param null $default
@@ -85,4 +78,14 @@ class Preferences
return $pref; return $pref;
} }
/**
* @return bool
*/
public function mark()
{
$this->set('lastActivity', microtime());
return true;
}
} }

View File

@@ -25,7 +25,7 @@ class Search implements SearchInterface
public function searchAccounts(array $words) public function searchAccounts(array $words)
{ {
return Auth::user()->accounts()->with('accounttype')->where( return Auth::user()->accounts()->with('accounttype')->where(
function(EloquentBuilder $q) use ($words) { function (EloquentBuilder $q) use ($words) {
foreach ($words as $word) { foreach ($words as $word) {
$q->orWhere('name', 'LIKE', '%' . e($word) . '%'); $q->orWhere('name', 'LIKE', '%' . e($word) . '%');
} }
@@ -43,7 +43,7 @@ class Search implements SearchInterface
/** @var Collection $set */ /** @var Collection $set */
$set = Auth::user()->budgets()->get(); $set = Auth::user()->budgets()->get();
$newSet = $set->filter( $newSet = $set->filter(
function(Budget $b) use ($words) { function (Budget $b) use ($words) {
$found = 0; $found = 0;
foreach ($words as $word) { foreach ($words as $word) {
if (!(strpos(strtolower($b->name), strtolower($word)) === false)) { if (!(strpos(strtolower($b->name), strtolower($word)) === false)) {
@@ -68,7 +68,7 @@ class Search implements SearchInterface
/** @var Collection $set */ /** @var Collection $set */
$set = Auth::user()->categories()->get(); $set = Auth::user()->categories()->get();
$newSet = $set->filter( $newSet = $set->filter(
function(Category $c) use ($words) { function (Category $c) use ($words) {
$found = 0; $found = 0;
foreach ($words as $word) { foreach ($words as $word) {
if (!(strpos(strtolower($c->name), strtolower($word)) === false)) { if (!(strpos(strtolower($c->name), strtolower($word)) === false)) {
@@ -103,7 +103,7 @@ class Search implements SearchInterface
{ {
// decrypted transaction journals: // decrypted transaction journals:
$decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where( $decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where(
function(EloquentBuilder $q) use ($words) { function (EloquentBuilder $q) use ($words) {
foreach ($words as $word) { foreach ($words as $word) {
$q->orWhere('description', 'LIKE', '%' . e($word) . '%'); $q->orWhere('description', 'LIKE', '%' . e($word) . '%');
} }
@@ -113,7 +113,7 @@ class Search implements SearchInterface
// encrypted // encrypted
$all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get(); $all = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 1)->get();
$set = $all->filter( $set = $all->filter(
function(TransactionJournal $journal) use ($words) { function (TransactionJournal $journal) use ($words) {
foreach ($words as $word) { foreach ($words as $word) {
$haystack = strtolower($journal->description); $haystack = strtolower($journal->description);
$word = strtolower($word); $word = strtolower($word);
@@ -129,7 +129,7 @@ class Search implements SearchInterface
$filtered = $set->merge($decrypted); $filtered = $set->merge($decrypted);
$filtered->sortBy( $filtered->sortBy(
function(TransactionJournal $journal) { function (TransactionJournal $journal) {
return intval($journal->date->format('U')); return intval($journal->date->format('U'));
} }
); );

View File

@@ -2,7 +2,6 @@
namespace FireflyIII\Support; namespace FireflyIII\Support;
use Cache;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -25,15 +24,14 @@ class Steam
{ {
// abuse chart properties: // abuse chart properties:
$properties = new CacheProperties; $cache = new CacheProperties;
$properties->addProperty($account->id); $cache->addProperty($account->id);
$properties->addProperty('balance'); $cache->addProperty('balance');
$properties->addProperty($date); $cache->addProperty($date);
$properties->addProperty($ignoreVirtualBalance); $cache->addProperty($ignoreVirtualBalance);
if ($properties->has()) { if ($cache->has()) {
return $properties->get(); return $cache->get();
} }
$md5 = $properties->getMd5();
// find the first known transaction on this account: // find the first known transaction on this account:
@@ -57,7 +55,7 @@ class Steam
if (!$ignoreVirtualBalance) { if (!$ignoreVirtualBalance) {
$balance = bcadd($balance, $account->virtual_balance); $balance = bcadd($balance, $account->virtual_balance);
} }
Cache::forever($md5, round($balance, 2)); $cache->store(round($balance, 2));
return round($balance, 2); return round($balance, 2);
} }

View File

@@ -19,18 +19,18 @@ class Budget extends Twig_Extension
*/ */
public function getFunctions() public function getFunctions()
{ {
$functions = []; $functions = [];
$functions[] = new Twig_SimpleFunction( $functions[] = new Twig_SimpleFunction(
'spentInRepetitionCorrected', function(LimitRepetition $repetition) { 'spentInRepetitionCorrected', function (LimitRepetition $repetition) {
$sum $sum
= Auth::user()->transactionjournals() = Auth::user()->transactionjournals()
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id') ->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('budget_limits', 'budget_limits.budget_id', '=', 'budget_transaction_journal.budget_id')
->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id') ->leftJoin('limit_repetitions', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
->before($repetition->enddate) ->before($repetition->enddate)
->after($repetition->startdate) ->after($repetition->startdate)
->where('limit_repetitions.id', '=', $repetition->id) ->where('limit_repetitions.id', '=', $repetition->id)
->get(['transaction_journals.*'])->sum('amount'); ->get(['transaction_journals.*'])->sum('amount');
return floatval($sum); return floatval($sum);
} }

View File

@@ -31,31 +31,31 @@ class General extends Twig_Extension
$filters = []; $filters = [];
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'formatAmount', function($string) { 'formatAmount', function ($string) {
return App::make('amount')->format($string); return App::make('amount')->format($string);
}, ['is_safe' => ['html']] }, ['is_safe' => ['html']]
); );
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'formatTransaction', function(Transaction $transaction) { 'formatTransaction', function (Transaction $transaction) {
return App::make('amount')->formatTransaction($transaction); return App::make('amount')->formatTransaction($transaction);
}, ['is_safe' => ['html']] }, ['is_safe' => ['html']]
); );
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'formatAmountPlain', function($string) { 'formatAmountPlain', function ($string) {
return App::make('amount')->format($string, false); return App::make('amount')->format($string, false);
}, ['is_safe' => ['html']] }, ['is_safe' => ['html']]
); );
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'formatJournal', function($journal) { 'formatJournal', function ($journal) {
return App::make('amount')->formatJournal($journal); return App::make('amount')->formatJournal($journal);
}, ['is_safe' => ['html']] }, ['is_safe' => ['html']]
); );
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'balance', function(Account $account = null) { 'balance', function (Account $account = null) {
if (is_null($account)) { if (is_null($account)) {
return 'NULL'; return 'NULL';
} }
@@ -67,7 +67,7 @@ class General extends Twig_Extension
// should be a function but OK // should be a function but OK
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'getAccountRole', function($name) { 'getAccountRole', function ($name) {
return Config::get('firefly.accountRoles.' . $name); return Config::get('firefly.accountRoles.' . $name);
} }
); );
@@ -83,32 +83,32 @@ class General extends Twig_Extension
$functions = []; $functions = [];
$functions[] = new Twig_SimpleFunction( $functions[] = new Twig_SimpleFunction(
'getCurrencyCode', function() { 'getCurrencyCode', function () {
return App::make('amount')->getCurrencyCode(); return App::make('amount')->getCurrencyCode();
} }
); );
$functions[] = new Twig_SimpleFunction( $functions[] = new Twig_SimpleFunction(
'getCurrencySymbol', function() { 'getCurrencySymbol', function () {
return App::make('amount')->getCurrencySymbol(); return App::make('amount')->getCurrencySymbol();
} }
); );
$functions[] = new Twig_SimpleFunction( $functions[] = new Twig_SimpleFunction(
'phpdate', function($str) { 'phpdate', function ($str) {
return date($str); return date($str);
} }
); );
$functions[] = new Twig_SimpleFunction( $functions[] = new Twig_SimpleFunction(
'env', function($name, $default) { 'env', function ($name, $default) {
return env($name, $default); return env($name, $default);
} }
); );
$functions[] = new Twig_SimpleFunction( $functions[] = new Twig_SimpleFunction(
'activeRoute', function($context) { 'activeRoute', function ($context) {
$args = func_get_args(); $args = func_get_args();
$route = $args[1]; $route = $args[1];
$what = isset($args[2]) ? $args[2] : false; $what = isset($args[2]) ? $args[2] : false;

View File

@@ -4,7 +4,6 @@ namespace FireflyIII\Support\Twig;
use App; use App;
use Cache;
use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournal;
use FireflyIII\Support\CacheProperties; use FireflyIII\Support\CacheProperties;
use Twig_Extension; use Twig_Extension;
@@ -30,13 +29,12 @@ class Journal extends Twig_Extension
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'typeIcon', function (TransactionJournal $journal) { 'typeIcon', function (TransactionJournal $journal) {
$prop = new CacheProperties(); $cache = new CacheProperties();
$prop->addProperty($journal->id); $cache->addProperty($journal->id);
$prop->addProperty('typeIcon'); $cache->addProperty('typeIcon');
if ($prop->has()) { if ($cache->has()) {
return $prop->get(); return $cache->get();
} }
$md5 = $prop->getMd5();
$type = $journal->transactionType->type; $type = $journal->transactionType->type;
@@ -57,7 +55,7 @@ class Journal extends Twig_Extension
$txt = ''; $txt = '';
break; break;
} }
Cache::forever($md5, $txt); $cache->store($txt);
return $txt; return $txt;

View File

@@ -22,7 +22,7 @@ class PiggyBank extends Twig_Extension
$functions = []; $functions = [];
$functions[] = new Twig_SimpleFunction( $functions[] = new Twig_SimpleFunction(
'currentRelevantRepAmount', function(PB $piggyBank) { 'currentRelevantRepAmount', function (PB $piggyBank) {
return $piggyBank->currentRelevantRep()->currentamount; return $piggyBank->currentRelevantRep()->currentamount;
} }
); );

View File

@@ -21,7 +21,7 @@ class Translation extends Twig_Extension
$filters = []; $filters = [];
$filters[] = new Twig_SimpleFilter( $filters[] = new Twig_SimpleFilter(
'_', function($name) { '_', function ($name) {
return trans('firefly.' . $name); return trans('firefly.' . $name);

View File

@@ -11,20 +11,20 @@ use Zizaco\Entrust\Traits\EntrustUserTrait;
* Class User * Class User
* *
* @package FireflyIII * @package FireflyIII
* @property integer $id * @property integer $id
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property string $email * @property string $email
* @property string $password * @property string $password
* @property string $reset * @property string $reset
* @property string $remember_token * @property string $remember_token
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Account[] $accounts
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Tag[] $tags
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Bill[] $bills * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Bill[] $bills
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Category[] $categories
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Preference[] $preferences * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Preference[] $preferences
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Reminder[] $reminders
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionjournals
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereId($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereCreatedAt($value) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\User whereCreatedAt($value)