only('name', 'email'); if ($request->password) { $data['password'] = Hash::make($request->password); } return response()->json($request->user()->update($data)); } }