Various code cleanup and fixed alignments.

This commit is contained in:
James Cole
2024-01-01 14:43:56 +01:00
parent 1368aafe5f
commit f963ac63f1
443 changed files with 3668 additions and 3672 deletions

View File

@@ -79,19 +79,19 @@ class CreateController extends Controller
public function create(Request $request, RuleGroup $ruleGroup = null)
{
$this->createDefaultRuleGroup();
$preFilled = [
$preFilled = [
'strict' => true,
];
$oldTriggers = [];
$oldActions = [];
$oldTriggers = [];
$oldActions = [];
// build triggers from query, if present.
$query = (string)$request->get('from_query');
$query = (string)$request->get('from_query');
if ('' !== $query) {
$search = app(SearchInterface::class);
$search = app(SearchInterface::class);
$search->parseQuery($query);
$words = $search->getWordsAsString();
$operators = $search->getOperators()->toArray();
$words = $search->getWordsAsString();
$operators = $search->getOperators()->toArray();
if ('' !== $words) {
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => $words]));
$operators[] = [
@@ -114,7 +114,7 @@ class CreateController extends Controller
$subTitleIcon = 'fa-clone';
// title depends on whether or not there is a rule group:
$subTitle = (string)trans('firefly.make_new_rule_no_group');
$subTitle = (string)trans('firefly.make_new_rule_no_group');
if (null !== $ruleGroup) {
$subTitle = (string)trans('firefly.make_new_rule', ['title' => $ruleGroup->title]);
}
@@ -146,7 +146,7 @@ class CreateController extends Controller
$request->session()->flash('info', (string)trans('firefly.instructions_rule_from_bill', ['name' => e($bill->name)]));
$this->createDefaultRuleGroup();
$preFilled = [
$preFilled = [
'strict' => true,
'title' => (string)trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]),
'description' => (string)trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]),
@@ -155,8 +155,8 @@ class CreateController extends Controller
// make triggers and actions from the bill itself.
// get triggers and actions for bill:
$oldTriggers = $this->getTriggersForBill($bill);
$oldActions = $this->getActionsForBill($bill);
$oldTriggers = $this->getTriggersForBill($bill);
$oldActions = $this->getActionsForBill($bill);
// restore actions and triggers from old input:
if (null !== $request->old()) {
@@ -169,7 +169,7 @@ class CreateController extends Controller
$subTitleIcon = 'fa-clone';
// title depends on whether there is a rule group:
$subTitle = (string)trans('firefly.make_new_rule_no_group');
$subTitle = (string)trans('firefly.make_new_rule_no_group');
// flash old data
$request->session()->flash('preFilled', $preFilled);
@@ -199,13 +199,13 @@ class CreateController extends Controller
$subTitle = (string)trans('firefly.make_new_rule_no_group');
// get triggers and actions for journal.
$oldTriggers = $this->getTriggersForJournal($journal);
$oldActions = [];
$oldTriggers = $this->getTriggersForJournal($journal);
$oldActions = [];
$this->createDefaultRuleGroup();
// collect pre-filled information:
$preFilled = [
$preFilled = [
'strict' => true,
'title' => (string)trans('firefly.new_rule_for_journal_title', ['description' => $journal->description]),
'description' => (string)trans('firefly.new_rule_for_journal_description', ['description' => $journal->description]),
@@ -253,9 +253,9 @@ class CreateController extends Controller
*/
public function store(RuleFormRequest $request)
{
$data = $request->getRuleData();
$data = $request->getRuleData();
$rule = $this->ruleRepos->store($data);
$rule = $this->ruleRepos->store($data);
session()->flash('success', (string)trans('firefly.stored_new_rule', ['title' => $rule->title]));
app('preferences')->mark();