forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmartInboxExistingTasks.php
More file actions
42 lines (36 loc) · 1.13 KB
/
SmartInboxExistingTasks.php
File metadata and controls
42 lines (36 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace ProcessMaker\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Facades\ProcessMaker\InboxRules\MatchingTasks;
use Facades\ProcessMaker\InboxRules\ApplyAction;
use Facades\ProcessMaker\Models\InboxRule;
use Illuminate\Database\Eloquent\ModelNotFoundException;
class SmartInboxExistingTasks implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public int $inboxRuleId;
/**
* Create a new job instance.
*/
public function __construct(int $inboxRuleId)
{
$this->inboxRuleId = $inboxRuleId;
}
/**
* Execute the job.
*/
public function handle(): void
{
//Load InboxRule by ID
$inboxRule = InboxRule::findOrFail($this->inboxRuleId);
$matchingTasks = MatchingTasks::get($inboxRule);
foreach ($matchingTasks as $task) {
ApplyAction::applyActionOnTask($task, $inboxRule);
}
}
}