1 | <?php |
||
17 | trait HasRelationships |
||
18 | { |
||
19 | /** |
||
20 | * List of available relations. |
||
21 | * |
||
22 | * @var string[] |
||
23 | */ |
||
24 | protected $relations = ['*']; |
||
25 | |||
26 | /** |
||
27 | * A list of autoloaded default relations. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $load = []; |
||
32 | |||
33 | /** |
||
34 | * Indicates if all relations are allowed. |
||
35 | 3 | * |
|
36 | * @return bool |
||
37 | 3 | */ |
|
38 | public function allowsAllRelations(): bool |
||
42 | |||
43 | /** |
||
44 | * Get a list of whitelisted relations. |
||
45 | * |
||
46 | * @return string[] |
||
47 | */ |
||
48 | public function getRelations(): array |
||
54 | |||
55 | /** |
||
56 | * Get a list of default relations. |
||
57 | * |
||
58 | * @return string[] |
||
59 | */ |
||
60 | public function getDefaultRelations(): array |
||
64 | |||
65 | /** |
||
66 | * Extract a deep list of default relations, recursively. |
||
67 | * |
||
68 | * @return string[] |
||
69 | */ |
||
70 | public function extractDefaultRelations(): array |
||
82 | |||
83 | /** |
||
84 | * |
||
85 | * |
||
86 | * @return string[] |
||
87 | */ |
||
88 | protected function getDefaultRelationsWithEagerLoads(): array |
||
98 | |||
99 | /** |
||
100 | * |
||
101 | * |
||
102 | * @param string $method |
||
103 | * @return \Closure |
||
104 | */ |
||
105 | protected function makeEagerLoadCallback(string $method): Closure |
||
111 | |||
112 | /** |
||
113 | * |
||
114 | * |
||
115 | * @param \Illuminate\Database\Eloquent\Model $model |
||
116 | * @param string $identifier |
||
117 | * @return mixed |
||
118 | */ |
||
119 | protected function resolveRelation(Model $model, string $identifier) |
||
127 | |||
128 | /** |
||
129 | * Resolve a container using the resolver callback. |
||
130 | * |
||
131 | * @return \Illuminate\Contracts\Container\Container |
||
132 | */ |
||
133 | protected abstract function resolveContainer(): Container; |
||
134 | } |
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.