/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int                      $id
  *
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\UpdateProfileRequest $request, User $user)
 {
     $this->authorize('edit-profile');
     if ($request->hasFile('file')) {
         $profilePic = $request->file('file');
         $id = md5($profilePic);
         $profilePic->move(public_path('/img/pp/'), $id);
         if (file_exists(public_path('img/pp/' . $user->picture_id))) {
             unlink(public_path('img/pp/' . $user->picture_id));
         }
         $user->picture_id = $id;
     }
     foreach ($request->only(['name', 'email']) as $key => $value) {
         $user->{$key} = $value;
     }
     $user->save();
     return redirect()->back();
 }
 public function store(UpdateProfileRequest $request)
 {
     $this->currentUser->update($request->only(['name', 'email']));
     flash()->success('Your account has been updated!');
     return back();
 }