Routine to delete rules. Should include routine to move rules to other group.

This commit is contained in:
James Cole
2016-01-13 21:44:26 +01:00
parent 06174d6afb
commit 4697fbdeef
10 changed files with 146 additions and 7 deletions

View File

@@ -124,7 +124,7 @@ class RuleController extends Controller
'active' => intval($request->input('active')) == 1,
];
$repository->update($ruleGroup, $data);
$repository->updateRuleGroup($ruleGroup, $data);
Session::flash('success', trans('firefly.updated_rule_group', ['title' => $ruleGroup->title]));
Preferences::mark();
@@ -141,6 +141,43 @@ class RuleController extends Controller
}
/**
* @param RuleGroup $budget
*
* @return \Illuminate\View\View
*/
public function deleteRuleGroup(RuleGroup $ruleGroup)
{
$subTitle = trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]);
// put previous url in session
Session::put('rules.rule-group.delete.url', URL::previous());
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'delete-rule-group');
return view('rules.rule-group.delete', compact('ruleGroup', 'subTitle'));
}
/**
* @param RuleGroup $ruleGroup
* @param RuleRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroyRuleGroup(RuleGroup $ruleGroup, RuleRepositoryInterface $repository)
{
$title = $ruleGroup->title;
$repository->destroyRuleGroup($ruleGroup);
Session::flash('success', trans('firefly.deleted_rule_group', ['title' => $title]));
Preferences::mark();
return redirect(Session::get('rules.rule-group.delete.url'));
}
/**
* @return View