1$paidFeesIds = Fee::whereHas('paidFees', function($q) {
2 $q->where('payment_status', 1);
3})->pluck('id')->toArray();
4
5$notPaidFeesIds = Fee::whereNotIn('id', $paidFeesIds)->pluck('id')->toArray();
1public function paidFees()
2{
3 return $this->hasMany(PaidFees::class, 'fee_id');
4}