journal->source_account->name); // get all the user's rule groups, with the rules, order by 'order'. /** @var User $user */ $user = Auth::user(); $groups = $user->ruleGroups()->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get(); // /** @var RuleGroup $group */ foreach ($groups as $group) { Log::debug('Now processing group "' . $group->title . '".'); $rules = $group->rules() ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') ->where('rule_triggers.trigger_type', 'user_action') ->where('rule_triggers.trigger_value', 'store-journal') ->where('rules.active', 1) ->get(['rules.*']); /** @var Rule $rule */ foreach ($rules as $rule) { Log::debug('Now handling rule #' . $rule->id . ' (' . $rule->title . ')'); $processor = new Processor($rule, $event->journal); // get some return out of this? $processor->handle(); if ($rule->stop_processing) { break; } } } // echo 'Done processing rules. See log.'; // exit; } }