Example #1
0
 public function update(UpdateUserProfileRequest $request)
 {
     $user = $this->user->update($request->all());
     if ($user->id) {
         flash()->success('更新成功');
     } else {
         flash()->error('更新失败');
     }
     return redirect()->back();
 }
Example #2
0
 /**
  * @param UpdateUserProfileRequest $request
  * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function update(UpdateUserProfileRequest $request)
 {
     $user = $this->user();
     // This checks of there's a need to upload the picture and saves the rest of the information if not.
     if ($request->file('profile') == null) {
         $this->repo->updateUser($request, $user);
         return redirect('/')->with('success', 'Profile Successfully updated');
     }
     //Uploads the prof pic and stores it in the database.
     if (!$this->fileRepository->uploadProfilePicture($_FILES['profile'], $request, $user)) {
         return redirect()->back()->withErrors('Profile Was Not Updated, Check if below 10mb or right extension.');
     }
     //Persists the rest of the data.
     $this->repo->updateUser($request, $user);
     return redirect('/');
 }