Support the ongoing development of →
Architecture Queues Jobs

To catch the job ID in the failed function of a job, you can access it through the $this->job property. Here is an example:

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class YourJob implements ShouldQueue
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public function __construct()

    public function handle()
        // Job logic

    public function failed(\Exception $exception = null)
        $jobId = $this->job->getJobId();

        // Perform actions with the job ID (e.g., sending a notification)

By using $this->job->getJobId(), you can retrieve the job ID within the failed function of your job. This gives you the flexibility to perform specific actions or send notifications related to the failed job using its ID.

Last updated 10 months ago.

lechuhuuha liked this reply


Sign in to participate in this thread!


Your banner here too?

Raj Bhatta rajmonto Joined 29 Jun 2023


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.