public function editprofile()
 {
     $name = Input::get('name');
     $email = Input::get('email');
     $contact = Input::get('contact');
     $webmail = Input::get('webmail');
     $gender = Input::get('gender');
     if (CityRep::where('email', $email)->where('id', '!=', Auth::crep()->get()->id)->count()) {
         $error = 'Another Ciryrep exists with the given email id.';
         return Redirect::route('crepprofile')->with('error', $error);
     }
     $crep = CityRep::find(Auth::crep()->get()->id);
     $crep->name = $name;
     $crep->email = $email;
     $crep->contact_home = $contact;
     $crep->webmail = $webmail;
     $crep->gender = $gender;
     $crep->save();
     //        return Input::get('contact');
     return Redirect::route('crepprofile');
 }
<?php

$count = CityRep::where('city_id', $city)->count();
echo $count;
 public function centrechange()
 {
     $emails = '';
     foreach (City::where('online', 1)->get() as $city) {
         CityRep::where('city_id', $city->id)->delete();
         foreach (User::where('city_id', $city->id)->get() as $user) {
             $emails .= $user->email1 . ';' . $user->email2 . ';';
         }
     }
     return $emails;
 }
 public function cityrep_present()
 {
     $city = Input::get('city');
     $city = City::find($city);
     if ($city->online == 1) {
         return 0;
     }
     return CityRep::where('city_id', $city->id)->count();
     return View::make('function.cityrep_present')->with('city', $city);
 }