/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($encadrantId = null, $stageId = null, $studentId = null) { //afficher all student of specifique encadrant of specifique stage of a specifique encadrant if (is_null($studentId)) { return Encadrant_Stage_Etudiant::join('Etudiant', 'Etudiant.id_Etudiant', '=', 'Encadrant_Stage_Etudiant.id_Etudiant')->select('Etudiant.*')->where('Encadrant_Stage_Etudiant.id_Enseignant', '=', $encadrantId)->where('Encadrant_Stage_Etudiant.id_Stage', '=', $stageId)->distinct()->get(); } else { $etudiant = Etudiant::find($studentId); return is_null($etudiant) ? response()->json(['error' => 'etudiant Note not found'], HttpResponse::HTTP_NOT_FOUND) : $etudiant; } }