/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($encadrantId = null, $serviceId = null)
 {
     if (is_null($serviceId)) {
         return Encadrant_Service_Etudiant::join('Service', 'Service.id_Service', '=', 'Encadrant_Service_Etudiant.id_Stage')->select('Service.*')->where('Encadrant_Service_Etudiant.id_Enseignant', '=', $encadrantId)->distinct()->get();
     } else {
         $service = Service::find($serviceId);
         return is_null($stage) ? response()->json(['error' => 'stage Note not found'], HttpResponse::HTTP_NOT_FOUND) : $service;
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($encadrantId = null)
 {
     //afficher all stage of a specifique encadrant
     if (is_null($encadrantId)) {
         return Encadrant_Service_Etudiant::join('Enseignant', 'Enseignant.id_Enseignant', '=', 'Encadrant_Service_Etudiant.id_Enseignant')->select('Enseignant.*')->distinct()->get();
     } else {
         $encadrant = Enseignant::find($encadrantId);
         return is_null($encadrant) ? response()->json(['error' => 'encadrant Note not found'], HttpResponse::HTTP_NOT_FOUND) : $encadrant;
     }
 }
 public function getEtudiantNValid($encadrantId)
 {
     $serviceId = $this->getServiceEnseig($encadrantId);
     return Encadrant_Service_Etudiant::where('Encadrant_Service_Etudiant.id_Service', '=', $serviceId)->join('Etudiant', 'Etudiant.id_Etudiant', '=', 'Encadrant_Service_Etudiant.id_Etudiant')->where('Encadrant_Service_Etudiant.isValid', '=', '0')->orWhere('Encadrant_Service_Etudiant.isValid', '=', '-1')->get();
 }