mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup
This commit is contained in:
parent
651dff0750
commit
01792f91e2
@ -67,7 +67,7 @@ class RuleController extends Controller
|
||||
'stop_processing' => $request->get('stop_processing'),
|
||||
];
|
||||
|
||||
$rule = $repository->storeRule($data);
|
||||
$rule = $repository->store($data);
|
||||
Session::flash('success', trans('firefly.stored_new_rule', ['title' => $rule->title]));
|
||||
Preferences::mark();
|
||||
|
||||
@ -313,7 +313,7 @@ class RuleController extends Controller
|
||||
'rule-action-stop' => $request->get('rule-action-stop'),
|
||||
'stop_processing' => intval($request->get('stop_processing')) == 1,
|
||||
];
|
||||
$repository->updateRule($rule, $data);
|
||||
$repository->update($rule, $data);
|
||||
|
||||
Session::flash('success', trans('firefly.updated_rule', ['title' => $rule->title]));
|
||||
Preferences::mark();
|
||||
@ -358,7 +358,7 @@ class RuleController extends Controller
|
||||
{
|
||||
|
||||
$title = $rule->title;
|
||||
$repository->destroyRule($rule);
|
||||
$repository->destroy($rule);
|
||||
|
||||
Session::flash('success', trans('firefly.deleted_rule', ['title' => $title]));
|
||||
Preferences::mark();
|
||||
@ -439,7 +439,7 @@ class RuleController extends Controller
|
||||
*/
|
||||
public function up(RuleRepositoryInterface $repository, Rule $rule)
|
||||
{
|
||||
$repository->moveRuleUp($rule);
|
||||
$repository->moveUp($rule);
|
||||
|
||||
return redirect(route('rules.index'));
|
||||
|
||||
@ -453,7 +453,7 @@ class RuleController extends Controller
|
||||
*/
|
||||
public function down(RuleRepositoryInterface $repository, Rule $rule)
|
||||
{
|
||||
$repository->moveRuleDown($rule);
|
||||
$repository->moveDown($rule);
|
||||
|
||||
return redirect(route('rules.index'));
|
||||
|
||||
|
@ -64,7 +64,7 @@ class RuleGroupController extends Controller
|
||||
'user' => Auth::user()->id,
|
||||
];
|
||||
|
||||
$ruleGroup = $repository->storeRuleGroup($data);
|
||||
$ruleGroup = $repository->store($data);
|
||||
|
||||
Session::flash('success', trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title]));
|
||||
Preferences::mark();
|
||||
@ -116,7 +116,7 @@ class RuleGroupController extends Controller
|
||||
'active' => intval($request->input('active')) == 1,
|
||||
];
|
||||
|
||||
$repository->updateRuleGroup($ruleGroup, $data);
|
||||
$repository->update($ruleGroup, $data);
|
||||
|
||||
Session::flash('success', trans('firefly.updated_rule_group', ['title' => $ruleGroup->title]));
|
||||
Preferences::mark();
|
||||
@ -143,7 +143,7 @@ class RuleGroupController extends Controller
|
||||
{
|
||||
$subTitle = trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]);
|
||||
|
||||
$ruleGroupList = Expandedform::makeSelectList($repository->getRuleGroups(), true);
|
||||
$ruleGroupList = Expandedform::makeSelectList($repository->get(), true);
|
||||
unset($ruleGroupList[$ruleGroup->id]);
|
||||
|
||||
// put previous url in session
|
||||
@ -167,7 +167,7 @@ class RuleGroupController extends Controller
|
||||
$title = $ruleGroup->title;
|
||||
$moveTo = Auth::user()->ruleGroups()->find(intval(Input::get('move_rules_before_delete')));
|
||||
|
||||
$repository->destroyRuleGroup($ruleGroup, $moveTo);
|
||||
$repository->destroy($ruleGroup, $moveTo);
|
||||
|
||||
|
||||
Session::flash('success', trans('firefly.deleted_rule_group', ['title' => $title]));
|
||||
@ -186,7 +186,7 @@ class RuleGroupController extends Controller
|
||||
*/
|
||||
public function up(RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup)
|
||||
{
|
||||
$repository->moveRuleGroupUp($ruleGroup);
|
||||
$repository->moveUp($ruleGroup);
|
||||
|
||||
return redirect(route('rules.index'));
|
||||
|
||||
@ -200,7 +200,7 @@ class RuleGroupController extends Controller
|
||||
*/
|
||||
public function down(RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup)
|
||||
{
|
||||
$repository->moveRuleGroupDown($ruleGroup);
|
||||
$repository->moveDown($ruleGroup);
|
||||
|
||||
return redirect(route('rules.index'));
|
||||
|
||||
|
@ -80,6 +80,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
return strtolower($account->name);
|
||||
}
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -113,6 +114,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
DB::Raw('SUM(`transactions`.`amount`) AS `balance`')
|
||||
]
|
||||
);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
@ -143,6 +145,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
}
|
||||
|
||||
$result = $query->get(['accounts.*']);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -173,6 +176,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->take(10)
|
||||
->get(['transaction_journals.*', 'transaction_currencies.symbol', 'transaction_types.type']);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->get(['transaction_journals.*', 'transactions.amount as journalAmount']);
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
@ -460,6 +461,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$amount = bcadd($amount, $paid->sum_amount);
|
||||
}
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
@ -515,6 +517,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
$amount = bcadd($amount, $bill->expectedAmount);
|
||||
}
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Models\RuleTrigger;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class RuleRepository
|
||||
@ -48,6 +47,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resetRulesInGroupOrder(RuleGroup $ruleGroup)
|
||||
@ -98,7 +98,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveRuleUp(Rule $rule)
|
||||
public function moveUp(Rule $rule)
|
||||
{
|
||||
$order = $rule->order;
|
||||
|
||||
@ -119,7 +119,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveRuleDown(Rule $rule)
|
||||
public function moveDown(Rule $rule)
|
||||
{
|
||||
$order = $rule->order;
|
||||
|
||||
@ -142,7 +142,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
*
|
||||
* @return Rule
|
||||
*/
|
||||
public function storeRule(array $data)
|
||||
public function store(array $data)
|
||||
{
|
||||
/** @var RuleGroup $ruleGroup */
|
||||
$ruleGroup = Auth::user()->ruleGroups()->find($data['rule_group_id']);
|
||||
@ -213,7 +213,7 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroyRule(Rule $rule)
|
||||
public function destroy(Rule $rule)
|
||||
{
|
||||
foreach ($rule->ruleTriggers as $trigger) {
|
||||
$trigger->delete();
|
||||
@ -264,9 +264,10 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $data
|
||||
*
|
||||
* @return Rule
|
||||
*/
|
||||
public function updateRule(Rule $rule, array $data)
|
||||
public function update(Rule $rule, array $data)
|
||||
{
|
||||
// update rule:
|
||||
$rule->active = $data['active'];
|
||||
|
@ -13,7 +13,6 @@ use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Models\RuleTrigger;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Interface RuleRepositoryInterface
|
||||
@ -27,7 +26,7 @@ interface RuleRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroyRule(Rule $rule);
|
||||
public function destroy(Rule $rule);
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
@ -39,6 +38,7 @@ interface RuleRepositoryInterface
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $ids
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reorderRuleTriggers(Rule $rule, array $ids);
|
||||
@ -46,41 +46,46 @@ interface RuleRepositoryInterface
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $ids
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reorderRuleActions(Rule $rule, array $ids);
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resetRulesInGroupOrder(RuleGroup $ruleGroup);
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveRuleUp(Rule $rule);
|
||||
public function moveUp(Rule $rule);
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
* @param array $data
|
||||
*
|
||||
* @return Rule
|
||||
*/
|
||||
public function updateRule(Rule $rule, array $data);
|
||||
public function update(Rule $rule, array $data);
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function moveRuleDown(Rule $rule);
|
||||
public function moveDown(Rule $rule);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Rule
|
||||
*/
|
||||
public function storeRule(array $data);
|
||||
public function store(array $data);
|
||||
|
||||
/**
|
||||
* @param Rule $rule
|
||||
|
Loading…
Reference in New Issue
Block a user