I'm having a form on my site with a number of inputs. When i look on my Analytics, the number of people who visit the page vs. the number of people who actually sucessfully submit the form is ~10:1. I assume this might be because of spam bots, but i would like to verify it. My form submit page returns usefull error messages on screen for each field that must be fixed, but maybe some error messages are unclear and users dont understand it.
Here is my code:
TestController::store(Request $request) {
$validatedData = $request->validate([
'product_id' => 'required|numeric|min:2',
'variant_id' => 'required|numeric|min:2',
'shipping_date' => 'required|date|after:yesterday|date_format:Y-m-d\TH:i',
'email' => 'email',
'color' => 'required|string',
'custom_request'=> 'required|string|min:50'
]);
...
// process and store user input
}
As far as I understand it, I only get $validatedData if the validation is successfull, otherwise the requests redirects back with error messages.
How would i write all invalid requests including their incomplete data to the laravel logfile so i can analyze it later?