mercredi 29 mars 2017

Last entry on join table

I've two table "questionnaires" and "question" link by the table "question_questionnaire". I want to retrive all questions of the last questionnaire with questionnaire.cible="personnel". I'm using laravel 5.3.

I've tried this but it doesn't work :

DB::table('questions')
 ->join('question_questionnaire','question_questionnaire.question_id','=','questions.id')
 ->join('questionnaires','questionnaires.id','=','question_questionnaire.questionnaire_id')
 ->orderBy('questionnaires.created_at','desc')
 ->first()->where('questionnaires.cible','=','personnel')->get();

Could you help me?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire