I'm wanting to be able to split my laravel error messaged into sections.
Lets say I have an insurance policy page that has 3 sections
Driver Details
Car Details
Policy Details
I'm using a laravel request like this
'driver_name' => 'required',
'address_line_1' => 'required',
'address_line_2' => 'required',
'address_line_3' => 'required',
'postcode' => 'required',
I want to be able to tag certain input errors when validating with an input request like this so that I can display an error message at the top of each section, instead of 1 giant error block with all the errors in it.
In the request, how would i send it back with a section tag like
'driver_name' => 'required|section:driverDetails'
To split the errors?
If laravel error messages cant be tagged, what would be the best practise to achieve this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire