<?php

$count = CityRep::where('city_id', $city)->count();
echo $count;
 public function chpass()
 {
     $oldpass = Input::get('oldpass');
     $newpass = Input::get('newpass');
     $cnfpass = Input::get('cnfnewpass');
     $pass = Auth::crep()->get()->password;
     if ($newpass === $cnfpass) {
         if (Hash::check($oldpass, $pass)) {
             $crep = CityRep::find(Auth::crep()->get()->id);
             $crep->password = Hash::make($newpass);
             $crep->save();
             return 'Password Updated';
         } else {
             return 'Old Password is incorrect.';
         }
     }
     return 'New Password and Confirm Password donot match';
 }
 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);
 }