public function allotcentres()
 {
     $schools = User::where('city_id', Auth::crep()->get()->city_id)->where('paid', 1)->groupBy('school_id')->get();
     $centres = Centre::where('city_id', Auth::crep()->get()->city_id)->where('left', '>', 0)->get();
     $opcent = '';
     foreach ($centres as $centre) {
         $id = Crypt::encrypt($centre->id);
         while (strpos($id, '=') !== false) {
             $id = Crypt::encrypt($centre->id);
         }
         $opcent .= '<option data-limit ="' . $centre->left . '" value="' . $id . '">' . $centre->name . ' (' . $centre->left . ' teams left)</option>';
     }
     return View::make('crep.allotcentres2')->with('schools', $schools)->with('centres', $opcent);
 }
 public function centrechanged()
 {
     $user = User::find(Auth::user()->get()->id);
     $city = Input::get('city');
     $user->centre_city = $city * 10;
     if (Centre::where('city_id', $city)->where('online', 'YES')->where('left', '>', 0)->count() > 0) {
         $centre = Centre::where('city_id', $city)->where('online', 'YES')->where('left', '>', 0)->first();
         $user->centre_id = $centre->id;
     }
     $user->save();
     return View::make('layouts.centrechanged')->with('user', $user);
 }