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 getDefaultRelations(): array |
||
46 | |||
47 | /** |
||
48 | * Get a list of scoped default relationships with eager load constraints. |
||
49 | * |
||
50 | * @return array |
||
51 | */ |
||
52 | public function getScopedDefaultRelations(): array |
||
68 | |||
69 | /** |
||
70 | * Get a list of nested default relationships with eager load constraints. |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | protected function getNestedDefaultRelations(): array |
||
84 | |||
85 | /** |
||
86 | * Resolve a relationship from a model instance. |
||
87 | * |
||
88 | * @param \Illuminate\Database\Eloquent\Model $model |
||
89 | * @param string $identifier |
||
90 | * @return mixed |
||
91 | */ |
||
92 | protected function resolveRelation(Model $model, string $identifier) |
||
100 | |||
101 | /** |
||
102 | * Resolve a related transformer from a class name string. |
||
103 | * |
||
104 | * @param string $transformer |
||
105 | * @return mixed |
||
106 | */ |
||
107 | protected function resolveTransformer(string $transformer) |
||
113 | |||
114 | /** |
||
115 | * Resolve a container using the resolver callback. |
||
116 | * |
||
117 | * @return \Illuminate\Contracts\Container\Container |
||
118 | */ |
||
119 | protected abstract function resolveContainer(): Container; |
||
120 | } |