Nov 27, 2019
0
Level 3
Form validation
I have an challance with a form validation:. This is the situation:
- company offers services
- these services belong to groups of kind of services
- the company has to select a minimal amount of services within each of these group
- the services have a relation with the company (stored in an pivot table)
- each service has an service_parent (parent of the service group)
my question: how can i validate that the user/company has selected
- an certain amount
- service_id's
- within a group of service_id,s (for example 1,2,3,4,5,6,7,8)
- and how to arrange the specific error messages
When i run dd of the request from an update i get the following (only relevant data)
Request {#43 ▼
#json: null
#convertedFiles: null
#userResolver: Closure {#439 ▶}
#routeResolver: Closure {#433 ▶}
+attributes: ParameterBag {#45 ▶}
+request: ParameterBag {#44 ▼
#parameters: array:26 [▼
"_method" => "PUT"
"_token" => "bKZjDRiqSWg"
"dp_name" => " Test"
"dp_street" => "Heaat"
"dp_housenum" => "59"
"dp_zipcode" => "9 LC"
"dp_facebook" => ""
"dp_twitter" => ""
"csrf-token" => "bKZj53hd9PRiqSWg"
"services" => array:178 [▼
3 => array:2 [▼
"service_check" => "3"
"service_id" => "3"
]
4 => array:1 [▼
"service_check" => "4"
]
5 => array:1 [▶]
6 => array:1 [▶]
7 => array:2 [▼
"service_check" => "7"
"service_id" => "7"
]
8 => array:1 [▶]
9 => array:1 [▶]
10 => array:1 [▶]
11 => array:2 [▶]
12 => array:1 [▶]
13 => array:1 [▶]
14 => array:1 [▶]
15 => array:2 [▶]
16 => array:1 [▶]
17 => array:1 [▶]
19 => array:1 [▶]
18 => array:2 [▶]
20 => array:1 [▶]
21 => array:1 [▶]
22 => array:1 [▶]
23 => array:2 [▶]
24 => array:1 [▶]
25 => array:1 [▶]
28 => array:2 [▶]
29 => array:1 [▶]
30 => array:1 [▶]
31 => array:1 [▶]
```
Please or to participate in this conversation.