1 week ago

Is there better way to write this code !

Posted 1 week ago by msaied

Hello i have this code below , is there better way to write it ! it's too long and am repeat query only change is in status number

$data['total_under_review'] = referral::where('referral_by_user_id',auth()->user()->id)->where('status',0)->get()->sum('commission_amount');

$data['total_approve'] = referral::where('referral_by_user_id',auth()->user()->id)->where('status',1)->get()->sum('commission_amount');

Please sign in or create an account to participate in this conversation.