validate(); $key = 'abuse-form:' . request()->ip(); if (RateLimiter::tooManyAttempts($key, 2)) { $this->addError('description', 'Too many abuse reports. Please try again in 5 minutes.'); return; } RateLimiter::increment($key, 300); try { $abuseReport = AbuseReport::create([ 'reporter_name' => $this->reporter_name, 'reporter_email' => $this->reporter_email, 'abuse_type' => $this->abuse_type, 'reported_url' => $this->reported_url, 'reported_user' => $this->reported_user, 'description' => $this->description, 'evidence' => $this->evidence, 'ip_address' => request()->ip(), 'user_agent' => request()->userAgent(), ]); RateLimiter::clear($key); $this->reset([ 'reporter_name', 'reporter_email', 'abuse_type', 'reported_url', 'reported_user', 'description', 'evidence' ]); $this->submitted = true; session()->flash('success', 'Thank you for your report. We will investigate this matter promptly.'); } catch (\Exception $e) { $this->addError('description', 'There was an error submitting your report. Please try again later.'); \Log::error('Abuse form error: ' . $e->getMessage()); } } public function getAbuseTypes() { return AbuseReport::getAbuseTypes(); } public function render() { return view('contactpage::abuse-form', [ 'abuseTypes' => $this->getAbuseTypes() ]); } }