I have many endpoints in Laravel that utilise FormRequests for validation. Is there a way to trigger those endpoints' validation only?
The use case for this is that I want to trigger multiple endpoints validation first and then trigger them fully if all is passing to avoid half-completed states.
The easiest way seems to be to just add a check to the controller, something like:
if($request->query('validation_only')){
return response('', 200);
}
// Normal logic
However, it seems a bit messy to start adding those everywhere. Is there a global way (perhaps using a certain HTTP Method or Header etc.) to trigger the controller/form request validation but not trigger the logic inside the controller method?
Thanks in advance!