Batch
Implements
Properties
$id string
The batch ID.
$name string
The batch name.
$totalJobs int
The total number of jobs that belong to the batch.
$pendingJobs int
The total number of jobs that are still pending.
$failedJobs int
The total number of jobs that have failed.
$failedJobIds array
The IDs of the jobs that have failed.
$options array
The batch options.
$createdAt Carbon\CarbonImmutable
The date indicating when the batch was created.
$cancelledAt Carbon\CarbonImmutable|null
The date indicating when the batch was cancelled.
$finishedAt Carbon\CarbonImmutable|null
The date indicating when the batch was finished.
Methods
__construct ( Factory $queue , BatchRepository $repository , string $id , string $name , int $totalJobs , int $pendingJobs , int $failedJobs , array $failedJobIds , array $options , Carbon\CarbonImmutable $createdAt , Carbon\CarbonImmutable $cancelledAt , Carbon\CarbonImmutable $finishedAt ) : void
Create a new batch instance.
Parameters
- $queue Factory
- $repository BatchRepository
- $id string
- $name string
- $totalJobs int
- $pendingJobs int
- $failedJobs int
- $failedJobIds array
- $options array
- $createdAt Carbon\CarbonImmutable
- $cancelledAt Carbon\CarbonImmutable|null
- $finishedAt Carbon\CarbonImmutable|null
fresh ( ) : self
Get a fresh instance of the batch represented by this ID.
prepareBatchedChain ( array $chain ) : Collection
Prepare a chain that exists within the jobs being added.
Parameters
- $chain array
processedJobs ( ) : int
Get the total number of jobs that have been processed by the batch thus far.
progress ( ) : int
Get the percentage of jobs that have been processed (between 0-100).
recordSuccessfulJob ( string $jobId ) : void
Record that a job within the batch finished successfully, executing any callbacks if necessary.
Parameters
- $jobId string
decrementPendingJobs ( string $jobId ) : UpdatedBatchJobCounts
Decrement the pending jobs for the batch.
Parameters
- $jobId string
finished ( ) : bool
Determine if the batch has finished executing.
hasThenCallbacks ( ) : bool
Determine if the batch has "success" callbacks.
allowsFailures ( ) : bool
Determine if the batch allows jobs to fail without cancelling the batch.
hasFailures ( ) : bool
Determine if the batch has job failures.
recordFailedJob ( string $jobId , $e ) : void
Record that a job within the batch failed to finish successfully, executing any callbacks if necessary.
Parameters
- $jobId string
- $e Throwable
incrementFailedJobs ( string $jobId ) : UpdatedBatchJobCounts
Increment the failed jobs for the batch.
Parameters
- $jobId string
hasCatchCallbacks ( ) : bool
Determine if the batch has "catch" callbacks.
hasFinallyCallbacks ( ) : bool
Determine if the batch has "finally" callbacks.
cancel ( ) : void
Cancel the batch.
canceled ( ) : bool
Determine if the batch has been cancelled.
cancelled ( ) : bool
Determine if the batch has been cancelled.
delete ( ) : void
Delete the batch from storage.
invokeHandlerCallback ( $handler , Batch $batch , Throwable $e ) : void
Invoke a batch callback handler.
Parameters
toArray ( ) : array
Convert the batch to an array.
jsonSerialize ( ) : array
Get the JSON serializable representation of the object.
__get ( $key ) : mixed
Dynamically access the batch's "options" via properties.
Parameters
- $key string