public function update(User $user, Request $request)
 {
     $this->validate($request, $user->getUpdateRules());
     $data = $request->only('name', 'email');
     if ($request->has('password')) {
         $data['password'] = $request->input('password');
     }
     if ($user->fill($data)->save()) {
         \Flash::success('Profile successfully updated!');
     }
     return redirect()->back();
 }