예제 #1
0
 public function updateCustomRecord($parameters)
 {
     $customer = ['lang_id_301' => $this->request->has('lang') ? $this->request->input('lang') : null, 'group_id_301' => $this->request->input('group'), 'date_301' => $this->request->has('date') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('date'))->getTimestamp() : null, 'company_301' => $this->request->has('company') ? $this->request->input('company') : null, 'tin_301' => $this->request->has('tin') ? $this->request->input('tin') : null, 'gender_id_301' => $this->request->has('gender') ? $this->request->input('gender') : null, 'treatment_id_301' => $this->request->has('treatment') ? $this->request->input('treatment') : null, 'state_id_301' => $this->request->has('state') ? $this->request->input('state') : null, 'name_301' => $this->request->has('name') ? $this->request->input('name') : null, 'surname_301' => $this->request->has('surname') ? $this->request->input('surname') : null, 'avatar_301' => $this->request->has('avatar') ? $this->request->input('avatar') : null, 'birth_date_301' => $this->request->has('birthDate') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('birthDate'))->getTimestamp() : null, 'phone_301' => $this->request->has('phone') ? $this->request->input('phone') : null, 'mobile_301' => $this->request->has('mobile') ? $this->request->input('mobile') : null, 'active_301' => $this->request->has('active'), 'country_id_301' => $this->request->has('country') ? $this->request->input('country') : null, 'territorial_area_1_id_301' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_301' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_301' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_301' => $this->request->has('cp') ? $this->request->input('cp') : null, 'locality_301' => $this->request->has('locality') ? $this->request->input('locality') : null, 'address_301' => $this->request->has('address') ? $this->request->input('address') : null, 'latitude_301' => $this->request->has('latitude') ? $this->request->input('latitude') : null, 'longitude_301' => $this->request->has('longitude') ? $this->request->input('longitude') : null];
     if ($parameters['specialRules']['emailRule']) {
         $customer['email_301'] = $this->request->input('email');
     }
     if ($parameters['specialRules']['userRule']) {
         $customer['user_301'] = $this->request->input('user');
     }
     if (!$parameters['specialRules']['passRule']) {
         $customer['password_301'] = Hash::make($this->request->input('password'));
     }
     Customer::where('id_301', $parameters['id'])->update($customer);
 }
예제 #2
0
파일: CrmLibrary.php 프로젝트: syscover/crm
 /**
  * Function updatePassword
  *
  * Input names to update customer password
  *
  * password_301 [password]
  *
  * @param   \Illuminate\Http\Request        $request
  * @return  \Syscover\Crm\Models\Customer   $customer
  * @throws  \Exception
  */
 public static function updatePassword(Request $request)
 {
     if (!$request->has('id')) {
         throw new \Exception('You have to indicate a id customer');
     }
     $customer = Customer::builder()->find($request->input('id'));
     if ($customer === null) {
         throw new \Exception('You have to indicate an id of a existing customer');
     }
     Customer::where('id_301', $request->input('id'))->update(['password_301' => Hash::make($request->input('password'))]);
 }