Skip to content

Commit

Permalink
chore: add throttle and logging to contact form (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyksaw authored Nov 10, 2024
1 parent af95f70 commit 03af937
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/Http/Controllers/Front/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public function store(ContactRequest $request)
Notification::route('mail', $email)
->notify($notification);

Log::info('Contact form submitted', [
'subject' => $validated['subject'],
'ip' => $request->ip(),
'user_agent' => $request->userAgent(),
]);

return redirect()
->route('front.contact')
->with(['success' => 'Your inquiry has been submitted. Thank you']);
Expand Down
3 changes: 2 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
->name('front.contact');

Route::post('/', [ContactController::class, 'store'])
->name('front.contact.submit');
->name('front.contact.submit')
->middleware('throttle:10,1');
});

Route::prefix('donate')->group(function () {
Expand Down

0 comments on commit 03af937

Please sign in to comment.