1 | <?php |
||
17 | abstract class Transformer extends TransformerAbstract |
||
18 | { |
||
19 | /** |
||
20 | * A list of all available relations. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $relations = ['*']; |
||
25 | |||
26 | /** |
||
27 | * Get relations set on the transformer. |
||
28 | * |
||
29 | * @return array |
||
30 | */ |
||
31 | public function getRelations():array |
||
39 | |||
40 | /** |
||
41 | * Set relations on the transformer. |
||
42 | * |
||
43 | * @param array|string $relations |
||
44 | * @return self |
||
45 | */ |
||
46 | public function setRelations($relations) |
||
52 | |||
53 | /** |
||
54 | * Check if the transformer has whitelisted all relations. |
||
55 | * |
||
56 | * @return bool |
||
57 | */ |
||
58 | public function allRelationsAllowed():bool |
||
62 | |||
63 | /** |
||
64 | * Call method for retrieving a relation. This method overrides Fractal's own |
||
65 | * [callIncludeMethod] method to load relations directly from your models. |
||
66 | * |
||
67 | * @param Scope $scope |
||
68 | * @param string $includeName |
||
69 | * @param mixed $data |
||
70 | * @return \League\Fractal\Resource\ResourceInterface|bool |
||
71 | * @throws \Exception |
||
72 | */ |
||
73 | protected function callIncludeMethod(Scope $scope, $includeName, $data) |
||
87 | |||
88 | /** |
||
89 | * Include pivot table data to the response. |
||
90 | * |
||
91 | * @param Pivot $pivot |
||
92 | * @return \League\Fractal\Resource\ResourceInterface|bool |
||
93 | */ |
||
94 | protected function includePivot(Pivot $pivot) |
||
104 | } |