/**
  * Update the specified biller in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $biller = Biller::findOrFail($id);
     $user = Auth::getUser();
     $validator = Validator::make($data = Input::all(), Biller::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $biller->name = Input::get('name');
     $biller->address_1 = Input::get('address_1');
     $biller->address_2 = Input::get('address_2');
     $biller->city = Input::get('city');
     $biller->zip = Input::get('zip');
     $biller->state = Input::get('state');
     $biller->country_id = Input::get('country_id');
     $biller->phone = Input::get('phone');
     $biller->mobile = Input::get('mobile');
     $biller->fax = Input::get('fax');
     $biller->email = Input::get('email');
     $biller->web = Input::get('web');
     if (Input::hasFile('logo')) {
         File::delete($biller->image_path, $biller->image_path_thumbnail);
         $file = Input::file('logo');
         $thumbnail = Image::make($file->getRealPath())->crop(200, 80);
         $destinationPath = 'uploads/' . $user->username . "/billers/";
         $filename_string = sha1(time() . time() . $file->getClientOriginalName());
         $filename = $filename_string . "." . $file->getClientOriginalExtension();
         $filename_thumb = $filename_string . "_thumb" . "." . $file->getClientOriginalExtension();
         if (!File::exists($destinationPath)) {
             mkdir($destinationPath, 0777, true);
         }
         $upload_success = Input::file('logo')->move($destinationPath, $filename) && $thumbnail->save($destinationPath . "/" . $filename_thumb);
         if ($upload_success) {
             $biller->image_name = $file->getClientOriginalName();
             $biller->image_path = $destinationPath . $filename;
             $biller->image_path_thumbnail = $destinationPath . $filename_thumb;
         }
     }
     $biller->save();
     return Redirect::to('billers/' . $biller->id . '/edit')->with('success', Lang::get('billers.message.success.update'));
 }