lundi 26 février 2018

Implementing Where Not In using Eloquent Models not working

I am trying to perform a query that displays only contents which are in table staff and table hr_validations but not in Table coo_validations. Below is my laravel code:

$loan = staff::select('staff_name','staff_id_fk','loan_amount','loan_tenor','hr_validations.id')
        ->join('hr_validations','hr_validations.staff_id_fk','=','staff.staff_id')
        ->whereNotIn('hr_validations.id','coo_validations.loan_id');
        return([$loan->pluck('staff_id_fk'), $loan->pluck('loan_amount'), $loan->pluck('loan_tenor'), $loan->pluck('hr_validations.id')]);  

But it's returning an error ("invalid argument supplied for foreach"). Any help rendered would be appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire