/** * Retourne un tableau contenant pour chaque promotion : * -promotion_id : de la promotion * -nb_offre_stage : nombre de stage rataché à la promotion a pourvoir (disponible cad stagiaire_id == null) * -postuler : nombre totale candidature d'étudiant de la promotion en mode recherche de stage (recherche == 1) * @param $promotion tableau id des promotions concernées * @return mixed */ public function getStatistiqueOffreStageParPromotion($promotion) { return OffreStage::select('promotion_id', DB::raw('count(distinct offre_stages.id) as nb_offre_stage'), DB::raw('count(etudiant_offre_stage.id) as postuler'))->join('etudiant_offre_stage', 'etudiant_offre_stage.offre_stage_id', '=', 'offre_stages.id')->whereIn('promotion_id', $promotion)->whereValide('1')->whereNull('stagiaire_id')->groupBy('promotion_id')->orderBy('promotion_id')->get(); }