validate($request, [ 'currentPassword' => 'required', 'password' => 'required|confirmed|min:8', ]); if (!Hash::check( $request->currentPassword, Auth::user()->password) ) { return response()->json(['message' => __('errors.wrong_current_password')], 400); } if (!config('app.options.isDemoApp') ) { $request->user()->update([ 'password' => bcrypt($request->password), ]); } return response()->json(['message' => __('auth.forms.password_successfully_changed')]); } }