Skip to content

Commit

Permalink
Merge pull request #8 from bakaphp/feat-rules-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken authored Dec 21, 2021
2 parents fac3f58 + e1bd90d commit 6ae7aca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Traits/CanUseRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ trait CanUseRules
*
* search rules for companies and systems_modules
*
* @param mixed $event
* @param mixed $event
* @param bool $useAsync
*
* @return void
*/
public function fireRules(string $event) : void
public function fireRules(string $event, bool $useAsync = true) : void
{
if ($this->enableWorkflows === false) {
return;
Expand All @@ -43,7 +44,7 @@ public function fireRules(string $event) : void

if ($rules->count()) {
foreach ($rules as $rule) {
if ($rule->isAsync()) {
if ($rule->isAsync() && $useAsync) {
RulesJob::dispatch($rule, $event, $this);
} else {
$rulesJobs = new RulesJob($rule, $event, $this);
Expand Down

0 comments on commit 6ae7aca

Please sign in to comment.