whoisService = $whoisService; } public function index() { return view('frontend.whois.index'); } /** * Get domain whois information * * @param WhoisRequest $request * @return JsonResponse */ public function getDomainInfo(WhoisRequest $request): JsonResponse { try { $domain = $request->validated()['domain']; $data = $this->whoisService->getDomainInfo($domain); return response()->json([ 'success' => true, 'message' => __('Domain information retrieved successfully.'), 'data' => $data ], 200); } catch (Exception $e) { return response()->json([ 'success' => false, 'message' => __('Failed to retrieve domain information.'), 'errors' => [ 'domain' => [$e->getMessage()] ] ], 400); } } /** * Check if domain is available * * @param WhoisRequest $request * @return JsonResponse */ public function checkAvailability(WhoisRequest $request): JsonResponse { try { $domain = $request->validated()['domain']; $isAvailable = $this->whoisService->isDomainAvailable($domain); $status = $this->whoisService->getDomainStatus($domain); return response()->json([ 'success' => true, 'message' => __('Domain availability checked successfully.'), 'data' => [ 'domain' => $domain, 'available' => $isAvailable, 'status' => $status ] ], 200); } catch (Exception $e) { return response()->json([ 'success' => false, 'message' => __('Failed to check domain availability.'), 'errors' => [ 'domain' => [$e->getMessage()] ] ], 400); } } }