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