I'm new to Laravel and am trying to figure out the best location / best practice for logging a specific form request. I've created a Form Request class for handling the form validation which extends Illuminate\Foundation\Http\FormRequest
through App\Http\Requests\Request
.
Where is the best place to log the full request whether it broke the validation rules or not? Is this a case for Middleware or should I overwrite some function in my custom form class, etc.? Incidentally, I'm not requiring authorization (am returning true from the authorize function), so that doesn't factor in specifically.
In your abstract Request
class you can overwrite failedValidation(Validator $validator)
method that fires if validation rules are failed.
You can implement logging logic there.