我正在尝试在我的工作中获取工作ID。我尝试$this->job->getJobId()但是它返回一个空字符串。
<?php
namespace App\Jobs\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Auth;
class SendNotification implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct($notification, $fireShutdown)
{
$this->notification = $notification;
$this->fireShutdown = $fireShutdown;
}
public function handle()
{
dd($this->job->getJobId());
// Some Code
}
}
UYOU