/**
  * @param UpdateProfileRequest                $request
  * @param UserProfileFieldRepositoryInterface $userProfileFields
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postProfile(UpdateProfileRequest $request, UserProfileFieldRepositoryInterface $userProfileFields)
 {
     // handle updates to the user model
     $input = $request->only(['usertitle']);
     $input['dob'] = $request->get('date_of_birth_day') . '-' . $request->get('date_of_birth_month') . '-' . $request->get('date_of_birth_year');
     $this->guard->user()->update($input);
     // handle profile field updates
     $profileFieldData = $request->get('profile_fields');
     foreach ($request->getProfileFields() as $profileField) {
         $userProfileFields->updateOrCreate($this->guard->user(), $profileField, $profileFieldData[$profileField->id]);
     }
     return redirect()->route('account.profile')->withSuccess(trans('account.saved_profile'));
 }
Exemple #2
0
 /**
  * @return bool
  */
 public function has_value()
 {
     return $this->userProfileFields->hasForProfileField($this->guard->user(), $this->getWrappedObject());
 }