Route::match(['get', 'post'], '/', 'InscritController@index'); Route::post('/add', 'InscritController@store'); Route::post('/rech', 'InscritController@create'); }); //Resultat groupe Route::group(['prefix' => '/{examen_id}/resultat', 'before' => 'examenId'], function () { // dipslay the hole notes Route::match(['get', 'post'], '/', 'ExamenNoteController@show'); // display the student's exame note Route::match(['get', 'post'], '/{examen_note_id}', 'ExamenNoteController@show')->where('examen_note_id', '[0-9]+'); // test if the a student with specified id not found Route::filter('examenNoteId', function (Illuminate\Routing\Route $route) { if (is_null($route->getParameter('examen_note_id'))) { return Redirect::to('session/' . $route->getParameter('session_id') . '/examen/' . $route->getParameter('examen_id') . '/resultat'); } else { if (is_null(Note_Examen::find($route->getParameter('examen_note_id')))) { return Response::json(['error' => 'reusltat not found'], HttpResponse::HTTP_NOT_FOUND); } } }); // station note group Route::group(['prefix' => '/{examen_note_id}/station', 'before' => 'examenNoteId'], function () { // display all station notes Route::match(['get', 'post'], '/', 'StationNoteController@show'); // display specific banque item Route::match(['get', 'post'], '/{station_note_id}', 'StationNoteController@show')->where('station_note_id', '[0-9]+'); // test if the a note exam with specified id not found Route::filter('stationNoteId', function (Illuminate\Routing\Route $route) { if (is_null($route->getParameter('station_note_id'))) { return Redirect::to('session/' . $route->getParameter('session_id') . '/examan/' . $route->getParameter('examen_id') . '/resultat/' . $route->getParameter('examen_note_id') . '/station'); if (is_null(Note_Station::find($route->getParameter('station_note_id')))) {
function getExamenNote($examenNoteId) { return Note_Examen::find($examenNoteId); }