/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(\Request $request)
 {
     if ($request::isMethod('post')) {
         $validator = Validator::make(Input::all(), District::$groupUpdateRules);
         //if ($validator->passes()) { @TODO fix this to accept array in Group::$groupUpdateRules
         if ($validator->passes()) {
             if (District::updateGroups($request)) {
                 return Redirect::to('/districts')->with('message', 'The following errors occurred')->withErrors('Update success')->with('flag', 'success');
             }
             return Redirect::to('/districts')->with('message', 'The following errors occurred')->withErrors('Update failed')->with('flag', 'danger');
         }
         return Redirect::to('/districts')->with('message', 'The following errors occurred')->withErrors($validator)->withInput()->with('flag', 'danger');
     }
     $allorganizations = Organization::all();
     $data = District::with('organization')->paginate(25);
     return view('districts/all', compact('data', 'allorganizations'));
 }