public function store() { $v = Validator::make($data = Input::all(), Lead::$rules); if ($v->fails()) { return Response::json(array('flash' => 'Something went wrong, try again !'), 500); } else { $lead = new Lead(); $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' => 'User ini yang mengawali lead ini')); return Response::json(array('success' => true, 'flash' => 'New lead has been successfully created !'), 200); } }