Laravel - Queues - Defining Batchable Jobs

To define a batchable job, you should create a queueable job as normal; however, you should add the Illuminate\Bus\Batchable trait to the job class. This trait provides access to a batch method which may be used to retrieve the current batch that the job is executing within:

    
    batch()->cancelled()) {
                // Determine if the batch has been cancelled...
    
                return;
            }
    
            // Import a portion of the CSV file...
        }
    }