Stevemo\Cpanel\User\Repo\UserRepository::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)
    {
        $user = $this->findById($id);
        $user->first_name = $attributes['first_name'];
        $user->last_name = $attributes['last_name'];
        $user->email = $attributes['email'];
        $user->permissions = $attributes['permissions'];
        if (array_key_exists('password', $attributes)) {
            $user->password = $attributes['password'];
        }
        $user->save();
        if (array_key_exists('groups', $attributes)) {
            $this->syncGroups($attributes['groups'], $user);
        }
        $this->event->fire('users.update', array($user));
        return $user;
    }