0
If the type of person selected is F is valid through the FisicaRequest
public function store(FisicaRequest $reqFisica, JuridicaRequest $reqJuridica)
{
if ($reqFisica->tipo_pessoa == "F") {
$data = $reqFisica->all();
Devedor::create($data);
return redirect()->route('admin.devedors.index');
}
if ($reqJuridica->tipo_pessoa == "J") {
$data = $reqJuridica->all();
Devedor::create($data);
return redirect()->route('admin.devedors.index');
}
}
However I am not getting the legal entity to be validated by Juridicarequest.
uses the request validate and validates how many digits are being passed dom min and max
– Lucas Antonio
the second request is populated? how does the framework know which object should be injected? I believe that two requests in the same method will not work
– gmsantos
In Http request, you only have one Request, you can use different validation logics in Formrequest
– Jorge Costa