/** * Save a new entity in repository * * @throws ValidatorException * @param array $attributes * @return mixed */ public function createByAdmin(array $attributes) { parent::skipPresenter(); $attributes['password_last_set'] = new Carbon(); if (array_has($attributes, 'must_change_password')) { $attributes['password_last_set'] = null; } $user = parent::create($attributes); $this->updateProfile($attributes, $user['id']); return $user; }
/** * Save a new entity in repository * * @throws ValidatorException * @param array $attributes * @return mixed */ public function createByAdmin(array $attributes, $roles = null) { parent::skipPresenter(); $attributes['password_last_set'] = new Carbon(); if (array_has($attributes, 'must_change_password')) { $attributes['password_last_set'] = null; } $attributes['password'] = bcrypt($attributes['password']); $user = parent::create($attributes); $user->roles()->sync($roles); return $user; }