Skip to content

Instantly share code, notes, and snippets.

@tderick
Created August 30, 2022 01:14
Show Gist options
  • Save tderick/3532f6d164507824c9152466c8ee9635 to your computer and use it in GitHub Desktop.
Save tderick/3532f6d164507824c9152466c8ee9635 to your computer and use it in GitHub Desktop.
<?php
public function store(Request $request)
{
$this->validate($request, [
'name' => 'required',
'email' => 'required',
'message' => 'required',
'g-recaptcha-response' => 'required|recaptchav3:contact,0.5'
]);
$requestData = $request->all();
$contact = Contact::create($requestData);
Mail::to(env("ADMIN_EMAIL"))->send(new ContactMail($contact)); # The code we've added
return redirect('contact')->with("status", "Your message has been sent");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment