1 | <?php |
||
5 | trait HasParameters |
||
6 | { |
||
7 | /** |
||
8 | * Parameters attribute setter. |
||
9 | * |
||
10 | * @param array|string $parameters |
||
11 | */ |
||
12 | public function setParametersAttribute($parameters) |
||
20 | |||
21 | /** |
||
22 | * Get a value in fluent parameters. |
||
23 | * |
||
24 | * @param string $key |
||
25 | * @param string $default |
||
26 | * @return mixed |
||
27 | */ |
||
28 | public function param($key, $default = '') |
||
32 | |||
33 | /** |
||
34 | * Fluent version of the entity json encoded parameters. |
||
35 | * |
||
36 | * @return \Illuminate\Support\Fluent |
||
37 | */ |
||
38 | public function fluentParameters() |
||
44 | } |
||
45 |
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: