1 | <?php |
||
9 | trait SanitizesInput |
||
10 | { |
||
11 | /** |
||
12 | * Sanitize input before validating. |
||
13 | * |
||
14 | * Kept for backwards compatibility with Laravel <= 5.5 |
||
15 | */ |
||
16 | public function validate() |
||
21 | |||
22 | /** |
||
23 | * Sanitize input before validating. |
||
24 | * |
||
25 | * Compatible with Laravel 5.6+ |
||
26 | */ |
||
27 | public function validateResolved() |
||
32 | |||
33 | /** |
||
34 | * Sanitize this request's input. |
||
35 | */ |
||
36 | public function sanitize() |
||
42 | |||
43 | /** |
||
44 | * Add custom fields to the Sanitizer. |
||
45 | */ |
||
46 | public function addCustomFilters() |
||
52 | |||
53 | /** |
||
54 | * Filters to be applied to the input. |
||
55 | * |
||
56 | * @return array |
||
57 | */ |
||
58 | public function filters() |
||
62 | |||
63 | /** |
||
64 | * Custom Filters to be applied to the input. |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | public function customFilters() |
||
72 | } |
||
73 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: