Ejemplo n.º 1
0
 public function update($id)
 {
     $lead = Lead::findOrFail($id);
     $v = Validator::make($data = Input::except('id'), Lead::$rules);
     if ($v->fails()) {
         return Response::json(array('flash' => 'Something went wrong, try again !'), 500);
     } else {
         $user = Sentry::getUser();
         $lead->salutation = Input::get('salutation');
         $lead->first_name = Input::get('first_name');
         $lead->last_name = Input::get('last_name');
         $lead->phone = Input::get('phone');
         $lead->email = Input::get('email');
         $lead->instance = Input::get('instance');
         $lead->address = Input::get('address');
         $lead->address2 = Input::get('address2');
         $lead->description = Input::get('description');
         $lead->status_id = Input::get('status_id');
         $lead->save();
         $lead->users()->attach($user, array('notes' => 'Merubah data lead'));
         return Response::json(array('success' => true, 'flash' => 'The lead has been successfully updated !'), 200);
     }
 }