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 | * Get a list of default relations with eager load constraints. |
||
35 | * |
||
36 | * @return array |
||
37 | */ |
||
38 | public function defaultRelations(): array |
||
48 | |||
49 | /** |
||
50 | * Add eager load constraints to a list of relations. |
||
51 | * |
||
52 | * @param array $relations |
||
53 | * @return array |
||
54 | */ |
||
55 | protected function addEagerLoadConstraints(array $relations): array |
||
71 | |||
72 | /** |
||
73 | * Get a list of nested default relationships with eager load constraints. |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | protected function getNestedDefaultRelations(): array |
||
87 | |||
88 | /** |
||
89 | * Resolve a relationship from a model instance. |
||
90 | * |
||
91 | * @param \Illuminate\Database\Eloquent\Model $model |
||
92 | * @param string $identifier |
||
93 | * @return mixed |
||
94 | */ |
||
95 | protected function resolveRelation(Model $model, string $identifier) |
||
103 | |||
104 | /** |
||
105 | * Resolve a related transformer from a class name string. |
||
106 | * |
||
107 | * @param string $transformer |
||
108 | * @return mixed |
||
109 | */ |
||
110 | protected function resolveTransformer(string $transformer) |
||
116 | |||
117 | /** |
||
118 | * Resolve a container using the resolver callback. |
||
119 | * |
||
120 | * @return \Illuminate\Contracts\Container\Container |
||
121 | */ |
||
122 | protected abstract function resolveContainer(): Container; |
||
123 | } |