Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Sep 11, 2015
2 parents 60c90b5 + 74a274c commit fc7f15f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/Http/Controllers/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit fc7f15f

Please sign in to comment.