json(Auth::user()->only('name', 'email'), 200); } /** * Update the user's profile information. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function update(Request $request) { $user = $request->user(); $this->validate($request, [ 'name' => 'required', 'email' => 'required|email|unique:users,email,'.Auth::id(), 'password' => 'required', ]); if (!Hash::check( $request->password, Auth::user()->password) ) { return response()->json(['message' => __('errors.wrong_current_password')], 400); } if (!config('app.options.isDemoApp') ) { tap($user)->update($request->only('name', 'email')); } return response()->json([ 'message' => __('auth.forms.profile_saved'), 'username' => $request->name ]); } }