public function checkSpecialRulesToUpdate($parameters) { $customer = Customer::builder()->find($parameters['id']); $parameters['specialRules']['emailRule'] = $this->request->input('email') == $customer->email_301 ? true : false; $parameters['specialRules']['userRule'] = $this->request->input('user') == $customer->user_301 ? true : false; $parameters['specialRules']['passRule'] = !$this->request->has('password'); return $parameters; }
/** * 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'))]); }