Stevemo\Cpanel\User\Repo\CpanelUserInterface::update PHP Метод

update() публичный Метод

Update user information
Автор: Steve Montambeault
public update ( $id, array $attributes ) : Cartalyst\Sentry\Users\UserInterface
$id
$attributes array
Результат Cartalyst\Sentry\Users\UserInterface
    public function update($id, array $attributes);

Usage Example

Пример #1
0
 /**
  * Validate and update a existing user
  *
  * @author Steve Montambeault
  * @link   http://stevemo.ca
  *
  * @param array $data
  *
  * @return bool
  */
 public function update(array $data)
 {
     try {
         if ($this->validator->with($data)->validForUpdate()) {
             $this->users->update($data['id'], $this->validator->getData());
             return true;
         }
     } catch (LoginRequiredException $e) {
         $this->validator->add('LoginRequiredException', $e->getMessage());
     } catch (PasswordRequiredException $e) {
         $this->validator->add('PasswordRequiredException', $e->getMessage());
     } catch (UserExistsException $e) {
         $this->validator->add('UserExistsException', $e->getMessage());
     }
     return false;
 }