public function savecert($id)
 {
     $rules = array('certno' => 'required|min:3|unique:certificates');
     $messages = ['certno.unique' => 'The Certificate Number has already been issued to another vehicle.'];
     $validator = Validator::make(Input::only('certno'), $rules, $messages);
     if ($validator->passes()) {
         //$v = Vehicle::findOrFail($id);
         if (Certificate::where('vehicle_id', $id)->count() > 0) {
             return Redirect::to('vehicles/certificates')->with('error', 'The vehicle has already been issued with a certificate.');
         }
         $cert = new Certificate();
         $cert->certno = Input::get('certno');
         $cert->vehicle_id = $id;
         $cert->issued_by = Auth::id();
         $cert->save();
         return Redirect::to('vehicles/certificates')->with('success', 'Vehicle Certificate issued successfully');
     } else {
         return Redirect::to('vehicle/' . $id . '/issuecert')->withErrors($validator)->withInput();
     }
 }