Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DreadfulCthulhu's avatar

Pass extra variable to a blade when FormRequest validator fails

Hi, I have a form validator made by FormRequest with rules(), messages() and attribute() set. This validator is working fine, but I need when it fail to pass extra variable $active_tab = 1; to the blade to switch Bootstrap's tab to the right one, where inputs are located. Can you provide me a solution to do this? Thanks a lot

0 likes
1 reply
Nakov's avatar

You might need to override the failedValidation method:

protected function failedValidation( Validator $validator )
{
    parent::failedValidation($validator); // TODO: Change the autogenerated stub
}

Please or to participate in this conversation.