/** * Save user profile. * * @param \Orchestra\Model\User|\Illuminate\Database\Eloquent\Model $user * @param array $input * * @return void */ protected function saving($user, array $input) { $user->setAttribute('email', $input['email']); $user->setAttribute('fullname', $input['fullname']); $this->fireEvent('updating', [$user]); $this->fireEvent('saving', [$user]); $user->saveOrFail(); $this->fireEvent('updated', [$user]); $this->fireEvent('saved', [$user]); }
/** * Saving new password. * * @param \Orchestra\Model\User $user * @param array $input */ protected function saving(Eloquent $user, array $input) { $user->setAttribute('password', $input['new_password']); DB::transaction(function () use($user) { $user->save(); }); }
/** * Saving new user. * * @param \Orchestra\Model\User $user * @param array $input * @param string $password * * @return void */ protected function saving(Eloquent $user, array $input, $password) { $user->setAttribute('email', $input['email']); $user->setAttribute('fullname', $input['fullname']); $user->setAttribute('password', $password); $this->fireEvent('creating', [$user]); $this->fireEvent('saving', [$user]); DB::transaction(function () use($user) { $user->save(); $user->roles()->sync([Config::get('orchestra/foundation::roles.member', 2)]); }); $this->fireEvent('created', [$user]); $this->fireEvent('saved', [$user]); }
/** * Saving new password. * * @param \Orchestra\Model\User $user * @param array $input */ protected function saving(Eloquent $user, array $input) { $user->setAttribute('password', $input['new_password']); $user->saveOrFail(); }