@vincent15000 You don’t use form requests in Livewire components, as Livewire components don’t work with a single request. If you want to re-use rules, then abstract them to their own validation class that both the form request and Livewire component can make use of, instead of trying to misuse the form request.
Mar 4, 2025
2
Level 63
Livewire and a form request for fields validation ?
Hello,
I like using form requests to validate the fields when I use standard routes for CRUD.
The Livewire documentation says that it's possible to validate the fields by defining a rules() function.
As there is already this function in a form request, how is it possible to use a standard Laravel form request to validate the different fields in a Livewire form ?
Would it be as simple as returing (new CategoryRequest)->rules() from the Livewire rules() function ? Or is there another way to that properly ?
Thanks for your help.
V
Level 80
1 like
Please or to participate in this conversation.