From 74a274cc35fcaa9af1cceef94c0ba9dc6c857921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20Jos=C3=A9?= Date: Fri, 11 Sep 2015 09:51:29 +0200 Subject: [PATCH] Parche para poder borrar alumnos con faltas de asistencia + Parche para corregir el fallo tras fallar el login --- app/Http/Controllers/RoomController.php | 8 +++++++- app/Http/routes.php | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/RoomController.php b/app/Http/Controllers/RoomController.php index 1fcc3a5..1632001 100644 --- a/app/Http/Controllers/RoomController.php +++ b/app/Http/Controllers/RoomController.php @@ -6,6 +6,7 @@ use App\Models\Service; use App\Models\Room; use App\Models\RoomService; +use App\Models\Assistance; use App\Models\RoomReserve; use App\Http\Controllers\Controller; @@ -185,7 +186,12 @@ public function postAssignClientToGroup(Request $request) public function postDelinkClient(Request $request) { $data = $request->all(); - $roomReserve = RoomReserve::whereRaw('fk_client = '.$data['fk_client'].' AND fk_room_service = '.$data['fk_room_service']); + $roomReserve = RoomReserve::whereRaw('fk_client = '.$data['fk_client'].' AND fk_room_service = '.$data['fk_room_service'])->first(); + //Pre-delete the assistance notes + $assistances = Assistance::where('fk_room_reserve','=', $roomReserve->id)->get(); + foreach($assistances as $assistance){ + $assistance->delete(); + } //Delete it if exists if($roomReserve) $roomReserve->delete(); diff --git a/app/Http/routes.php b/app/Http/routes.php index 89df3fa..45a72a0 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -21,6 +21,9 @@ return view('login'); }); Route::post('auth/login', 'Auth\AuthController@postLogin'); +Route::get('auth/login',function(){ + return view('login'); +}); Route::get('auth/logout', 'Auth\AuthController@getLogout'); //ONLY ON DEV Route::get('auth/register', 'Auth\AuthController@getRegister');