1 | <?php |
||
19 | trait HasLinksTrait |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Append attributes to query when building a query. |
||
24 | * |
||
25 | * @param string[]|string $attributes |
||
26 | * @return $this |
||
27 | */ |
||
28 | abstract public function append($attributes); |
||
29 | |||
30 | /** |
||
31 | * Get the value of the model's route key. |
||
32 | * |
||
33 | * @return mixed |
||
34 | */ |
||
35 | abstract public function getRouteKey(); |
||
36 | |||
37 | /** |
||
38 | * Add the links attribute to the model. |
||
39 | */ |
||
40 | public function initializeHasLinksTrait(): void |
||
44 | |||
45 | /** |
||
46 | * Get the links for this model. |
||
47 | * @return mixed[] |
||
48 | * @throws ReflectionException |
||
49 | */ |
||
50 | public function getLinksAttribute(): array |
||
60 | |||
61 | /** |
||
62 | * Returns the _links for the REST responses. |
||
63 | * |
||
64 | * @return mixed[] |
||
65 | */ |
||
66 | public function buildLinks(): array |
||
83 | |||
84 | |||
85 | /** |
||
86 | * Builds the links to create the relationship resources. |
||
87 | * |
||
88 | * @return mixed[] |
||
89 | * @throws ReflectionException |
||
90 | */ |
||
91 | public function buildRelationshipLinks(): array |
||
134 | |||
135 | |||
136 | /** |
||
137 | * Return the name for the resource route this model |
||
138 | * @return string|null |
||
139 | */ |
||
140 | public function getRouteName(): ?string |
||
148 | } |
||
149 |