Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.
This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Add support to get more information on the job class #2663

Description

@iahmedsuhail

Currently, Job Middleware has the WithoutOverlapping amongst some other middlewares. It would be useful to have something that would allow accessing important information from the job, like the name of the job that was called, and the attributes of the class.

This would mean that I could use middleware to Log all important information about a job and send those logs to other places, maybe using the Log support.

I tried writing something on my own, but it looks like the $job attribute you get in the middleware isn't very useful and can only be used to pass it to the callback amongst some information (doesn't have much information that is accessible).

<?php

namespace App\Jobs\Middleware;

class Log
{
    /**
     * Logs the job and its details before and after processing a job.
     *
     * @param  mixed  $job
     * @param  callable  $next
     * @return mixed
     */
    public function handle($job, $next)
    {
        // $job isn't very useful here
    }
}

Some useful attributes that can be made available on the job can be the name of the class, the payload the job was called with, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions