nova-scheduled-jobs icon indicating copy to clipboard operation
nova-scheduled-jobs copied to clipboard

Job name and description not shown

Open CarstenRuetz opened this issue 5 years ago • 1 comments

Hi!

First of all, thanks for your work, I like the tool!

However, I don't seem to get one thing to work: the name of the job and its description are not shown.

    protected function schedule(Schedule $schedule)
    {
        $schedule->call('\App\Console\Job1')->everyMinute();
    }

I tried passing the ::class and generating an actual object with 'new' as well: no difference.

The actual job:

namespace App\Console;

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


class Job1 implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $description = 'Fake job...';

    public function __construct()
    {
        // do s.th.
    }

    public function __invoke()
    {
        // do s.th. 
    }

}

But in the overview of your tool, the job name remains "Closure" and the description is empty.

Any ideas what I'm doing wrong?

As another question: the dispatch button stays greyed out as well. Any ideas?

Thanks in advance! Carsten

CarstenRuetz avatar Feb 14 '20 17:02 CarstenRuetz

namespace

add \Jobs\ folder to namespace

oleksandr-roskovynskyi avatar Jul 30 '20 20:07 oleksandr-roskovynskyi

@oleksandr-roskovynskyi Has the right answer for why the dispatch button is greyed out.

For the name and description, Jobs inherit from \Illuminate\Console\Scheduling\CallbackEvent which are essentially closures. The latest version (6.0.0) has better support for this and should have the class name appearing now.

llaski avatar Dec 04 '22 13:12 llaski