Laravel Job 对急切加载关系不起作用

时间:2021-02-06 12:24:30

标签: php laravel eloquent

我在 Laravel 有一份工作,是这样的:

class ProcessStockLevel implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable;
    
    public function handle()
    {
        $productsDb = Product::with('inStock')->whereNull('order_id')->get(); 
    }
}   

$productDb->inStock 始终为空。当我在队列之外运行此代码时,ewerything 按预期工作。队列中的急切加载有什么问题?

0 个答案:

没有答案