lundi 10 septembre 2018

eloquent get latest raw in join clause

I use laravel 5.2 I'm trying to get last intervention of each foreing key id like bellow:

$res = $this->model->with('typo', 'nro', 'ctr', 'cad', 'pm')

            ->join('a2t_intervention',function ($join) use ($salar){
                    $join->on('a2t_intervention.pmt_id','=','a2t_pmt.id');
                    $join->whereRaw('a2t_intervention.pmt_id = (select max(`pmt_id`) from a2t_intervention)');
                $join->where('a2t_intervention.etat_intervention','like','nok');
                $join->whereIN('a2t_intervention.id_equipe_stt',$salar);

            });

but I get this ERROR : Call to undefined method Illuminate\Database\Query\JoinClause::whereRaw()

I try other ways but nothig work for me, any help please



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2O6SX6w
via IFTTT

Aucun commentaire:

Enregistrer un commentaire