| 1 | <?php |
||
| 8 | trait InteractsWithValidationData |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Get all data under validation. |
||
| 12 | * |
||
| 13 | * @return array |
||
| 14 | */ |
||
| 15 | public function all() |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Get the validated data from the request. |
||
| 22 | * |
||
| 23 | * @return array |
||
| 24 | */ |
||
| 25 | public function validated() |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Get a subset containing the provided keys with values from the given data. |
||
| 36 | * |
||
| 37 | * @param array|mixed $keys |
||
| 38 | * |
||
| 39 | * @return array |
||
| 40 | */ |
||
| 41 | public function only($keys) |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Replaces the current parameters by a new set. |
||
| 62 | * |
||
| 63 | * @param array $parameters |
||
| 64 | */ |
||
| 65 | public function replace(array $data) |
||
| 69 | } |
||
| 70 |
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: