public function handle() { $users = new UserRepository(); $user = $users->findById($this->userId); $user->password = $this->newPassword; $user->update(); }
private function register($request) { $userRepository = new UserRepository(); $organizationRepository = new OrganizationRepository(); try { $organizationData = array('name' => $request->input('organization.name')); $userData = array('email' => $request->input('user.email'), 'firstname' => $request->input('user.firstname'), 'lastname' => $request->input('user.lastname')); $organization = $organizationRepository->createSubOrganization($organizationData); if ($organization) { $organizationAddress = new OrganizationInfo(); $organizationAddress->email = $request->input('organizationinfo.email'); $organizationAddress->address = $request->input('organizationinfo.address'); $organizationAddress->city = $request->input('organizationinfo.city'); $organizationAddress->state = $request->input('state'); $organizationAddress->zipcode = $request->input('organizationinfo.zipcode'); $organizationAddress->telephone = $request->input('organizationinfo.telephone'); $organization->info()->save($organizationAddress); $user = $userRepository->make($userData); if ($organization->users()->save($user)) { $user->assignRole(Role::ADMIN); } } } catch (Exception $e) { if (!is_null($organization)) { $organization->delete(); } Log::error($e->getMessage()); abort(500); } return $user; }