【发布时间】:2021-05-08 15:10:46
【问题描述】:
我有以下疑问...
$pgcs = PrivateGuard::with(['licences', 'state'])
->whereHas('licences', function($query){
$query->whereDate('expiration_of_licence', '<', Carbon::today())
->where('renewal', 0);
})
->where('status', 1)
->get();
我想获得具有满足上述条件的许可证的 $pgcs,whereDate 可以正常工作,但是 where('renewal', 0) 似乎不能正常工作。 上面的查询得到 $pgcs 的许可证的续订也是 = 1,虽然相同的 $pgc 也有续订值为 0 的许可证和另一个具有 1 的许可证,但我不想要一个具有任何续订价值的许可证的 $pgc 1 要在此查询中检索。我该怎么办?
【问题讨论】: