📜  使用模型比较 laravel 中的两个表 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:03.935000             🧑  作者: Mango

代码示例1
$paidFeesIds = Fee::whereHas('paidFees', function($q) {
    $q->where('payment_status', 1);
})->pluck('id')->toArray();

$notPaidFeesIds = Fee::whereNotIn('id', $paidFeesIds)->pluck('id')->toArray();