In Laravel 5.5, you can retrieve the Job ID once a job has been dispatched to the job queue using the following steps:
$job = new YourJob();
$jobId = $this->dispatch($job);
$job = new YourJob();
$jobId = $this->dispatch($job);
// Print the job ID
echo $jobId;
$job = JobModel::find($jobId);
// Retrieve the job ID from the job model
$jobId = $job->id;
// Print the job ID
echo $jobId;
Asked: 2022-06-21 11:00:00 +0000
Seen: 11 times
Last updated: Jul 01 '22