abstract | |
|---|---|
implements |
ShouldQueue, AuditedJobInterface |
uses |
Dispatchable, InteractsWithQueue, Queueable, SerializesModels |
The base of an audited job. Declare it in its module (AbstractJob, a jobs segment), and run its business through
the runner — one unit of work per step, each in a transaction of its own:
final class DunInvoicesJob extends AbstractAuditedJob
{
public function handle(WorkUnitRunnerInterface $runner, SdkContext $sdk, DunInvoiceUnit $dun): void
{
foreach ($this->dueInvoices() as $invoice) {
$runner->run($dun, new BusinessContext(parameters: ['invoice' => $invoice]), $sdk);
}
}
}
Its hull opens the run before handle(): dispatched from an action, a command or another job, it keeps that run's
key and acts for its initiator; scheduled, it acts as the automation actor. Dispatch it after the commit of the unit
of work that decided it (afterCommit()), never before.
| Methods | ||
|---|---|---|
public
|
middleware(): list<object>
|
# |