[13.x] Pass fresh batch to `BatchFinished` and `BatchCanceled` events
Merged
XU
1mo ago+7+7+0123456789-3-3-0123456789
BatchFinished and BatchCanceled are dispatched with the batch instance loaded before the job finished, so listeners get stale data:
Event::listen(function (BatchFinished $event) {
$event->batch->finished(); // false
});
Event::listen(function (BatchCanceled $event) {
$event->batch->cancelled(); // false
});
The then, catch and finally callbacks already receive $this->fresh(), this does the same for the events.