我在 Laravel 有一份工作,是这样的:
class ProcessStockLevel implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable;
public function handle()
{
$productsDb = Product::with('inStock')->whereNull('order_id')->get();
}
}
但 $productDb->inStock
始终为空。当我在队列之外运行此代码时,ewerything 按预期工作。队列中的急切加载有什么问题?