mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Merge pull request #81 from JC5/scrutinizer-patch-4
Scrutinizer Auto-Fixes
This commit is contained in:
commit
4d5124fb4c
@ -94,13 +94,13 @@ class ReportQuery implements ReportQueryInterface
|
|||||||
->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');
|
||||||
@ -254,24 +254,24 @@ 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');
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -31,7 +31,7 @@ class CategoryController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return $this
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ class CategoryController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function edit(Category $category)
|
public function edit(Category $category)
|
||||||
{
|
{
|
||||||
@ -105,14 +105,14 @@ class CategoryController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @param CategoryRepositoryInterface $repository
|
* @param CategoryRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function index(CategoryRepositoryInterface $repository)
|
public function index(CategoryRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
$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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -139,7 +139,7 @@ class CategoryController extends Controller
|
|||||||
* @param CategoryRepositoryInterface $repository
|
* @param CategoryRepositoryInterface $repository
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function show(CategoryRepositoryInterface $repository, Category $category)
|
public function show(CategoryRepositoryInterface $repository, Category $category)
|
||||||
{
|
{
|
||||||
@ -157,7 +157,7 @@ class CategoryController extends Controller
|
|||||||
* @param CategoryFormRequest $request
|
* @param CategoryFormRequest $request
|
||||||
* @param CategoryRepositoryInterface $repository
|
* @param CategoryRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function store(CategoryFormRequest $request, CategoryRepositoryInterface $repository)
|
public function store(CategoryFormRequest $request, CategoryRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ class CategoryController extends Controller
|
|||||||
// 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 +115,7 @@ class TagController extends Controller
|
|||||||
*
|
*
|
||||||
* @param TagRepositoryInterface $repository
|
* @param TagRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function edit(Tag $tag, TagRepositoryInterface $repository)
|
public function edit(Tag $tag, TagRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
@ -200,7 +200,7 @@ class TagController extends Controller
|
|||||||
*
|
*
|
||||||
* @param TagRepositoryInterface $repository
|
* @param TagRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function store(TagFormRequest $request, TagRepositoryInterface $repository)
|
public function store(TagFormRequest $request, TagRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
@ -244,7 +244,7 @@ class TagController extends Controller
|
|||||||
* @param TagRepositoryInterface $repository
|
* @param TagRepositoryInterface $repository
|
||||||
* @param Tag $tag
|
* @param Tag $tag
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function update(TagFormRequest $request, TagRepositoryInterface $repository, Tag $tag)
|
public function update(TagFormRequest $request, TagRepositoryInterface $repository, Tag $tag)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ class TransactionController extends Controller
|
|||||||
* @param AccountRepositoryInterface $repository
|
* @param AccountRepositoryInterface $repository
|
||||||
* @param string $what
|
* @param string $what
|
||||||
*
|
*
|
||||||
* @return View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function create(AccountRepositoryInterface $repository, $what = 'deposit')
|
public function create(AccountRepositoryInterface $repository, $what = 'deposit')
|
||||||
{
|
{
|
||||||
@ -75,7 +75,7 @@ class TransactionController extends Controller
|
|||||||
*
|
*
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function delete(TransactionJournal $journal)
|
public function delete(TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
@ -178,7 +178,7 @@ class TransactionController extends Controller
|
|||||||
* @param JournalRepositoryInterface $repository
|
* @param JournalRepositoryInterface $repository
|
||||||
* @param $what
|
* @param $what
|
||||||
*
|
*
|
||||||
* @return View
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function index(JournalRepositoryInterface $repository, $what)
|
public function index(JournalRepositoryInterface $repository, $what)
|
||||||
{
|
{
|
||||||
@ -244,12 +244,12 @@ class TransactionController extends Controller
|
|||||||
* @param JournalRepositoryInterface $repository
|
* @param JournalRepositoryInterface $repository
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return \Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ class TransactionController extends Controller
|
|||||||
* @param JournalFormRequest $request
|
* @param JournalFormRequest $request
|
||||||
* @param JournalRepositoryInterface $repository
|
* @param JournalRepositoryInterface $repository
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
|
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
@ -300,7 +300,7 @@ class TransactionController extends Controller
|
|||||||
* @param JournalRepositoryInterface $repository
|
* @param JournalRepositoryInterface $repository
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
* @return $this|\Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
|
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ class Reminders
|
|||||||
// get and list active reminders:
|
// get and list active reminders:
|
||||||
$reminders = $this->auth->user()->reminders()->today()->get();
|
$reminders = $this->auth->user()->reminders()->today()->get();
|
||||||
$reminders->each(
|
$reminders->each(
|
||||||
function (Reminder $reminder) use ($helper) {
|
function(Reminder $reminder) use ($helper) {
|
||||||
$reminder->description = $helper->getReminderText($reminder);
|
$reminder->description = $helper->getReminderText($reminder);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
// models
|
// models
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'account',
|
'account',
|
||||||
function ($value) {
|
function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||||
->where('account_types.editable', 1)
|
->where('account_types.editable', 1)
|
||||||
@ -31,7 +31,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'tj', function ($value) {
|
'tj', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = TransactionJournal::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
$object = TransactionJournal::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
||||||
if ($object) {
|
if ($object) {
|
||||||
@ -44,7 +44,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'currency', function ($value) {
|
'currency', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = TransactionCurrency::find($value);
|
$object = TransactionCurrency::find($value);
|
||||||
if ($object) {
|
if ($object) {
|
||||||
@ -56,7 +56,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'bill', function ($value) {
|
'bill', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = Bill::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
$object = Bill::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
||||||
if ($object) {
|
if ($object) {
|
||||||
@ -69,7 +69,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'budget', function ($value) {
|
'budget', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = Budget::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
$object = Budget::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
||||||
if ($object) {
|
if ($object) {
|
||||||
@ -82,7 +82,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'reminder', function ($value) {
|
'reminder', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
$object = Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
||||||
if ($object) {
|
if ($object) {
|
||||||
@ -95,7 +95,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'limitrepetition', function ($value) {
|
'limitrepetition', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = LimitRepetition::where('limit_repetitions.id', $value)
|
$object = LimitRepetition::where('limit_repetitions.id', $value)
|
||||||
->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
|
->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
|
||||||
@ -112,7 +112,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'piggyBank', function ($value) {
|
'piggyBank', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = PiggyBank::where('piggy_banks.id', $value)
|
$object = PiggyBank::where('piggy_banks.id', $value)
|
||||||
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
|
||||||
@ -128,7 +128,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'category', function ($value) {
|
'category', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
$object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
||||||
if ($object) {
|
if ($object) {
|
||||||
@ -142,7 +142,7 @@ Route::bind(
|
|||||||
|
|
||||||
/** @noinspection PhpUnusedParameterInspection */
|
/** @noinspection PhpUnusedParameterInspection */
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'reminder', function ($value) {
|
'reminder', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
/** @var \FireflyIII\Models\Reminder $object */
|
/** @var \FireflyIII\Models\Reminder $object */
|
||||||
$object = Reminder::find($value);
|
$object = Reminder::find($value);
|
||||||
@ -158,7 +158,7 @@ Route::bind(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Route::bind(
|
Route::bind(
|
||||||
'tag', function ($value) {
|
'tag', function($value) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$object = Tag::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
$object = Tag::where('id', $value)->where('user_id', Auth::user()->id)->first();
|
||||||
if ($object) {
|
if ($object) {
|
||||||
@ -189,7 +189,7 @@ Route::get('/routes', ['uses' => 'HomeController@routes', 'as' => 'routes']);
|
|||||||
* Home Controller
|
* Home Controller
|
||||||
*/
|
*/
|
||||||
Route::group(
|
Route::group(
|
||||||
['middleware' => ['auth', 'range', 'reminders']], function () {
|
['middleware' => ['auth', 'range', 'reminders']], function() {
|
||||||
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index', 'middleware' => 'cleanup']);
|
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index', 'middleware' => 'cleanup']);
|
||||||
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
|
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
|
||||||
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
|
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
|
||||||
|
@ -129,7 +129,7 @@ class Account extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return array
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getDates()
|
public function getDates()
|
||||||
{
|
{
|
||||||
@ -138,7 +138,7 @@ class Account extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param $fieldName
|
* @param string $fieldName
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
@ -208,7 +208,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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -49,7 +49,7 @@ 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'];
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class Category extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return array
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getDates()
|
public function getDates()
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ class PiggyBank extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getDates()
|
public function getDates()
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ class PiggyBank extends Model
|
|||||||
*
|
*
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
* @return int
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getRemindMeAttribute($value)
|
public function getRemindMeAttribute($value)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ class Reminder extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
protected $fillable = ['user_id', 'startdate', 'metadata', 'enddate', 'active', 'notnow', 'remindersable_id', 'remindersable_type',];
|
protected $fillable = ['user_id', 'startdate', 'metadata', 'enddate', 'active', 'notnow', 'remindersable_id', 'remindersable_type', ];
|
||||||
protected $hidden = ['encrypted'];
|
protected $hidden = ['encrypted'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,7 +89,7 @@ class Tag extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return array
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getDates()
|
public function getDates()
|
||||||
{
|
{
|
||||||
|
@ -224,7 +224,7 @@ class TransactionJournal extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return array
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getDates()
|
public function getDates()
|
||||||
{
|
{
|
||||||
@ -313,7 +313,7 @@ class TransactionJournal extends Model
|
|||||||
* @param EloquentBuilder $query
|
* @param EloquentBuilder $query
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return EloquentBuilder
|
||||||
*/
|
*/
|
||||||
public function scopeAfter(EloquentBuilder $query, Carbon $date)
|
public function scopeAfter(EloquentBuilder $query, Carbon $date)
|
||||||
{
|
{
|
||||||
@ -326,7 +326,7 @@ class TransactionJournal extends Model
|
|||||||
* @param EloquentBuilder $query
|
* @param EloquentBuilder $query
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return EloquentBuilder
|
||||||
*/
|
*/
|
||||||
public function scopeBefore(EloquentBuilder $query, Carbon $date)
|
public function scopeBefore(EloquentBuilder $query, Carbon $date)
|
||||||
{
|
{
|
||||||
@ -339,7 +339,7 @@ class TransactionJournal extends Model
|
|||||||
* @param EloquentBuilder $query
|
* @param EloquentBuilder $query
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return EloquentBuilder
|
||||||
*/
|
*/
|
||||||
public function scopeOnDate(EloquentBuilder $query, Carbon $date)
|
public function scopeOnDate(EloquentBuilder $query, Carbon $date)
|
||||||
{
|
{
|
||||||
@ -373,7 +373,7 @@ class TransactionJournal extends Model
|
|||||||
public function scopeWithRelevantData(EloquentBuilder $query)
|
public function scopeWithRelevantData(EloquentBuilder $query)
|
||||||
{
|
{
|
||||||
$query->with(
|
$query->with(
|
||||||
['transactions' => function (HasMany $q) {
|
['transactions' => function(HasMany $q) {
|
||||||
$q->orderBy('amount', 'ASC');
|
$q->orderBy('amount', 'ASC');
|
||||||
}, 'transactiontype', 'transactioncurrency', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories']
|
}, 'transactiontype', 'transactioncurrency', 'budgets', 'categories', 'transactions.account.accounttype', 'bill', 'budgets', 'categories']
|
||||||
);
|
);
|
||||||
|
@ -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'
|
||||||
);
|
);
|
||||||
|
@ -52,7 +52,7 @@ 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();
|
||||||
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -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');
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
public function getAccounts(array $types)
|
public function getAccounts(array $types)
|
||||||
{
|
{
|
||||||
$result = Auth::user()->accounts()->with(
|
$result = Auth::user()->accounts()->with(
|
||||||
['accountmeta' => function (HasMany $query) {
|
['accountmeta' => function(HasMany $query) {
|
||||||
$query->where('name', 'accountRole');
|
$query->where('name', 'accountRole');
|
||||||
}]
|
}]
|
||||||
)->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*'])->sortBy('name');
|
)->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*'])->sortBy('name');
|
||||||
@ -213,7 +213,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$accounts->each(
|
$accounts->each(
|
||||||
function (Account $account) use ($start, $end) {
|
function(Account $account) use ($start, $end) {
|
||||||
$account->startBalance = Steam::balance($account, $start, true);
|
$account->startBalance = Steam::balance($account, $start, true);
|
||||||
$account->endBalance = Steam::balance($account, $end, true);
|
$account->endBalance = Steam::balance($account, $end, true);
|
||||||
$account->piggyBalance = 0;
|
$account->piggyBalance = 0;
|
||||||
@ -251,7 +251,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
$end = clone Session::get('end', new Carbon);
|
$end = clone Session::get('end', new Carbon);
|
||||||
|
|
||||||
$accounts->each(
|
$accounts->each(
|
||||||
function (Account $account) use ($start, $end) {
|
function(Account $account) use ($start, $end) {
|
||||||
$account->startBalance = Steam::balance($account, $start);
|
$account->startBalance = Steam::balance($account, $start);
|
||||||
$account->endBalance = Steam::balance($account, $end);
|
$account->endBalance = Steam::balance($account, $end);
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
public function getTransfersInRange(Account $account, Carbon $start, Carbon $end)
|
public function getTransfersInRange(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$set = TransactionJournal::whereIn(
|
$set = TransactionJournal::whereIn(
|
||||||
'id', function (Builder $q) use ($account, $start, $end) {
|
'id', function(Builder $q) use ($account, $start, $end) {
|
||||||
$q->select('transaction_journals.id')
|
$q->select('transaction_journals.id')
|
||||||
->from('transactions')
|
->from('transactions')
|
||||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||||
@ -304,7 +304,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
}
|
}
|
||||||
)->get();
|
)->get();
|
||||||
$filtered = $set->filter(
|
$filtered = $set->filter(
|
||||||
function (TransactionJournal $journal) use ($account) {
|
function(TransactionJournal $journal) use ($account) {
|
||||||
if ($journal->destination_account->id == $account->id) {
|
if ($journal->destination_account->id == $account->id) {
|
||||||
return $journal;
|
return $journal;
|
||||||
}
|
}
|
||||||
@ -424,7 +424,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ($openingBalance) { // opening balance is zero, should we delete it?
|
if ($openingBalance) { // opening balance is zero, should we delete it?
|
||||||
$openingBalance->delete();// delete existing opening balance.
|
$openingBalance->delete(); // delete existing opening balance.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return float
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function billPaymentsInRange(Bill $bill, Carbon $start, Carbon $end)
|
public function billPaymentsInRange(Bill $bill, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return boolean|null
|
||||||
*/
|
*/
|
||||||
public function destroy(Bill $bill)
|
public function destroy(Bill $bill)
|
||||||
{
|
{
|
||||||
@ -258,7 +258,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return boolean|null
|
||||||
*/
|
*/
|
||||||
public function scan(Bill $bill, TransactionJournal $journal)
|
public function scan(Bill $bill, TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
@ -331,7 +331,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
* @return Bill|static
|
* @return Bill
|
||||||
*/
|
*/
|
||||||
public function update(Bill $bill, array $data)
|
public function update(Bill $bill, array $data)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return double
|
||||||
*/
|
*/
|
||||||
public function getWithoutBudgetSum(Carbon $start, Carbon $end)
|
public function getWithoutBudgetSum(Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -330,7 +330,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
* @param $amount
|
* @param $amount
|
||||||
*
|
*
|
||||||
* @return LimitRepetition|null
|
* @return BudgetLimit
|
||||||
*/
|
*/
|
||||||
public function updateLimitAmount(Budget $budget, Carbon $date, $amount)
|
public function updateLimitAmount(Budget $budget, Carbon $date, $amount)
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -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');
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -29,7 +29,7 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* @param int $reminderId
|
* @param int $reminderId
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return boolean|null
|
||||||
*/
|
*/
|
||||||
public function deactivateReminder($reminderId)
|
public function deactivateReminder($reminderId)
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
* @param Transaction $transaction
|
* @param Transaction $transaction
|
||||||
*
|
*
|
||||||
* @return float
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getAmountBefore(TransactionJournal $journal, Transaction $transaction)
|
public function getAmountBefore(TransactionJournal $journal, Transaction $transaction)
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
* @param TransactionJournal $journal
|
* @param TransactionJournal $journal
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return TransactionJournal
|
||||||
*/
|
*/
|
||||||
public function update(TransactionJournal $journal, array $data)
|
public function update(TransactionJournal $journal, array $data)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return boolean|null
|
||||||
*/
|
*/
|
||||||
public function destroy(PiggyBank $piggyBank)
|
public function destroy(PiggyBank $piggyBank)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ class ReminderRepository implements ReminderRepositoryInterface
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
$active->each(
|
$active->each(
|
||||||
function (Reminder $reminder) {
|
function(Reminder $reminder) {
|
||||||
$reminder->description = $this->helper->getReminderText($reminder);
|
$reminder->description = $this->helper->getReminderText($reminder);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -62,7 +62,7 @@ class ReminderRepository implements ReminderRepositoryInterface
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
$dismissed->each(
|
$dismissed->each(
|
||||||
function (Reminder $reminder) {
|
function(Reminder $reminder) {
|
||||||
$reminder->description = $this->helper->getReminderText($reminder);
|
$reminder->description = $this->helper->getReminderText($reminder);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -88,7 +88,7 @@ class ReminderRepository implements ReminderRepositoryInterface
|
|||||||
)->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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -64,7 +64,7 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
* @param Carbon $end
|
* @param Carbon $end
|
||||||
*
|
*
|
||||||
* @return float
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end)
|
public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -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'));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -21,7 +21,7 @@ class Budget extends Twig_Extension
|
|||||||
{
|
{
|
||||||
$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')
|
||||||
|
@ -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;
|
||||||
|
@ -26,7 +26,7 @@ class Journal extends Twig_Extension
|
|||||||
$filters = [];
|
$filters = [];
|
||||||
|
|
||||||
$filters[] = new Twig_SimpleFilter(
|
$filters[] = new Twig_SimpleFilter(
|
||||||
'typeIcon', function (TransactionJournal $journal) {
|
'typeIcon', function(TransactionJournal $journal) {
|
||||||
$type = $journal->transactionType->type;
|
$type = $journal->transactionType->type;
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -59,7 +59,7 @@ class Journal extends Twig_Extension
|
|||||||
$functions = [];
|
$functions = [];
|
||||||
|
|
||||||
$functions[] = new Twig_SimpleFunction(
|
$functions[] = new Twig_SimpleFunction(
|
||||||
'invalidJournal', function (TransactionJournal $journal) {
|
'invalidJournal', function(TransactionJournal $journal) {
|
||||||
if (!isset($journal->transactions[1]) || !isset($journal->transactions[0])) {
|
if (!isset($journal->transactions[1]) || !isset($journal->transactions[0])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ class Journal extends Twig_Extension
|
|||||||
);
|
);
|
||||||
|
|
||||||
$functions[] = new Twig_SimpleFunction(
|
$functions[] = new Twig_SimpleFunction(
|
||||||
'relevantTags', function (TransactionJournal $journal) {
|
'relevantTags', function(TransactionJournal $journal) {
|
||||||
if ($journal->tags->count() == 0) {
|
if ($journal->tags->count() == 0) {
|
||||||
return App::make('amount')->formatJournal($journal);
|
return App::make('amount')->formatJournal($journal);
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user