/** * 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; } }
if (is_null(Encadrant_Stage_Etudiant::find($route->getParameter('stage_id')))) { return Response::json(['error' => 'stage not found'], HttpResponse::HTTP_NOT_FOUND); } } }); Route::group(['prefix' => '/{stage_id}/student', 'before' => 'stageId'], function () { // dipslay the hole banque Route::match(['get', 'post'], '/', 'StageStudentController@show'); // display banque item Route::match(['get', 'post'], '/{student_id}', 'StageStudentController@show')->where('student_id', '[0-9]+'); Route::match(['get', 'post'], '/{student_id}/valid', 'StageStudentController@update'); Route::filter('studentId', function (Illuminate\Routing\Route $route) { if (is_null($route->getParameter('student_id'))) { return Redirect::to('encadrant' . $route->getParameter('encadrant_id') . '/stage/' . $route->getParameter('stage_id') . '/student'); } else { if (is_null(Encadrant_Stage_Etudiant::find($route->getParameter('student_id')))) { return Response::json(['error' => 'stage not found'], HttpResponse::HTTP_NOT_FOUND); } } }); }); }); }); //}); //jury group Route::group(['prefix' => 'jury', 'middleware' => ['auth', 'session.privilege']], function () { // dipslay the jury's exames Route::match(['get', 'post'], '/{id_Jury}', 'JuryController@index')->where('id_Jury', '[0-9]+'); }); Route::group(['prefix' => 'mobile'], function () { Route::match(['post'], '/signin', 'Auth\\AuthController@postMobileLogin');