comparison of two tables in laravel using model
$paidFeesIds = Fee::whereHas('paidFees', function($q) {
$q->where('payment_status', 1);
})->pluck('id')->toArray();
$notPaidFeesIds = Fee::whereNotIn('id', $paidFeesIds)->pluck('id')->toArray();
3.67
6
public function paidFees()
{
return $this->hasMany(PaidFees::class, 'fee_id');
}
Thank you!
6
0
Are there any code examples left?
New code examples in category PHP