1 | <?php |
||
8 | trait HasLinks |
||
9 | { |
||
10 | /** |
||
11 | * @param string|Closure|null|array $controller |
||
12 | * @param null $parameters |
||
13 | * |
||
14 | * @return \Spatie\ResourceLinks\LinkResource |
||
15 | */ |
||
16 | public function links($controller = null, $parameters = null): LinkResource |
||
26 | |||
27 | /** |
||
28 | * @param string|Closure|null|array $controller |
||
29 | * @param null $parameters |
||
30 | * |
||
31 | * @return \Spatie\ResourceLinks\LinkResource |
||
32 | */ |
||
33 | public static function collectionLinks($controller = null, $parameters = null): LinkResource |
||
37 | } |
||
38 |
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: