/**
  * BlockControl.
  *
  * Block or unblock the user out off the system.
  * Preventing them to login into the system.
  *
  * @param int $status, The status code. 1 = Block | 0 = Unblock.
  * @param int $id      ,     The id off the user.
  */
 public function blockControl($status, $id)
 {
     if (!Auth::user()->is('admin') || Auth::user()->is('developer') || Auth::user()->is('moderator')) {
         return Redirect::route('trips.index', ['selector' => 'all']);
     }
     $user = user::find($id);
     $user->status = $status;
     $user->save();
     $sessionQuery = Sessions::where('user_id', $id)->get();
     if (count($sessionQuery) == 1 && $status == 1) {
         Sessions::where('user_id', $id)->delete();
     }
     // Set flash message data.
     // Displayed when u block a user
     if ($status == 0) {
         // unblock
         $message = 'U hebt een gebruiker terug geactiveerd';
     } elseif ($status == 1) {
         // block
         $message = 'U hebt een gebruiker geblokkeerd';
     } else {
         // unknown
         $message = 'wij konden niet uitmaken welke handeling u wou uitvoeren.';
     }
     session()->flash('flash_title', 'Success!');
     session()->flash('flash_message', $message);
     session()->flash('flash_message_important', '');
     return Redirect::back();
 }
 public function cancelClaim()
 {
     $ID = Input::get("CLAIM_ID");
     $affectedRows = Claims::where('Claim_ID', '=', $ID)->update(array('Status' => 2, 'Updated_By' => 1, 'Updated_At' => date('Y-m-d')));
     if ($affectedRows > 0) {
         $affectedRows1 = Sessions::where('Claim_No', '=', $ID)->update(array('Status' => 'Canceled', 'Updated_By' => 1, 'Updated_At' => date('Y-m-d')));
         if ($affectedRows1 > 0) {
             $ini = array('OK' => 'OK');
             return Response::json($ini);
         } else {
             $ini = array('No Data' => $ID);
             return Response::json($ini);
         }
     } else {
         $ini = array('No Data' => $ID);
         return Response::json($ini);
     }
 }