/**
  * 
  * @Put("pagos/bonos/edit/{id}")
  */
 public function updateBonus(Request $request, $id)
 {
     $this->validate($request, ['name' => 'required|unique:bonus,name,' . $id . '|min:3', 'price' => 'required|numeric', 'value' => 'required|integer']);
     $bonus = Bonus::find($id);
     $bonus->fill($request->all());
     $bonus->save();
     Session::flash('message', 'Bono editado correctamente');
     return Redirect::to('/pagos');
 }
 /**
  * Update the specified resource in storage.
  *
  * @Put("user/update/{id}")
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $user = User::find($id);
     // $user->fill($request->all());
     $user->name = $request->name;
     $user->email = $request->email;
     $user->phone = $request->phone;
     $user->type_id = $request->type_id;
     $user->sex = $request->sex;
     if ($request->avatar) {
         $user->avatar = $request->avatar;
     }
     if ($request->payment_id != 0) {
         $user->payment_day = date('Y-m-d');
     } else {
         $user->payment_id = 0;
     }
     $user->payment_id = $request->payment_id;
     $bonus = Bonus::find($request->bonus_id);
     if ($request->bonus_id != 0) {
         $user->bonus_days = $bonus->value;
     } else {
         $user->bonus_days = 0;
     }
     $user->bonus_id = $request->bonus_id;
     $user->save();
     Session::flash('message', 'Usuario editado correctamente');
     return Redirect::to('/user');
 }