/**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(PasswordRequest $request)
 {
     $user = Profile::loginProfile()->user;
     if (Hash::check($request->input('old_password'), $user->password)) {
         // The passwords match...
         $user->password = bcrypt($request->input('password'));
         $user->save();
         Flash::info('Password Updated');
         return redirect(route('home'));
     }
     $errors = [];
     $errors['old_password'] = '******';
     return $request->response($errors);
 }
 public function postSetting(PasswordRequest $request, User $user)
 {
     $user = Auth::user();
     $credentials = ['password' => $request->input('old_password')];
     if (!Auth::validate($credentials)) {
         return redirect()->back()->withErrors(['old_password' => 'Old password do not match the record.']);
     }
     $user->password = bcrypt($request->input('new_password'));
     Auth::logout();
     return redirect('auth/login')->withSuccess(['message' => 'Password changed successfully!', 'type' => 'success']);
 }
 public function updatesetting(PasswordRequest $request)
 {
     $user = Auth::user();
     $password_lama = $request->input('password_lama');
     if (!Hash::check($password_lama, $user->password)) {
         return redirect()->back()->with('error', 'Password lama yang anda masukkan salah.');
     }
     if ($request->input('password') == '') {
         $input['password'] = $user->password;
     } else {
         $input['password'] = bcrypt($request->input('password'));
     }
     return redirect()->route('admin::setting')->with('message', 'Profil user telah diupdate...');
     /*if(bcrypt::check($newpassword, $oldpassword)){
     			$tes = User::findOrFail(5);
     			$tes->password = bcrypt::make(input::get('newpassword'));
     			$tes->save();
     		}
     		else{
     			var_dump('gagal');
     		}
     
     		$input = $request->all();
     		return redirect()->route('admin::user');*/
 }