@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @var array |
23 | 23 | */ |
24 | - protected $relations = ['*']; |
|
24 | + protected $relations = [ '*' ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Get relations set on the transformer. |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function getRelations():array |
32 | 32 | { |
33 | - $relations = array_unique(array_merge($this->getAvailableIncludes(), $this->relations)); |
|
33 | + $relations = array_unique( array_merge( $this->getAvailableIncludes(), $this->relations ) ); |
|
34 | 34 | |
35 | - return array_filter($relations, function($relation) { |
|
35 | + return array_filter( $relations, function ( $relation ) { |
|
36 | 36 | return $relation !== '*'; |
37 | 37 | }); |
38 | 38 | } |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * @param array|string $relations |
44 | 44 | * @return self |
45 | 45 | */ |
46 | - public function setRelations($relations) |
|
46 | + public function setRelations( $relations ) |
|
47 | 47 | { |
48 | - $this->setAvailableIncludes(array_merge($this->availableIncludes, (array) $relations)); |
|
48 | + $this->setAvailableIncludes( array_merge( $this->availableIncludes, (array) $relations ) ); |
|
49 | 49 | |
50 | 50 | return $this; |
51 | 51 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function allRelationsAllowed():bool |
59 | 59 | { |
60 | - return $this->relations == ['*']; |
|
60 | + return $this->relations == [ '*' ]; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | * @return \League\Fractal\Resource\ResourceInterface|bool |
71 | 71 | * @throws \Exception |
72 | 72 | */ |
73 | - protected function callIncludeMethod(Scope $scope, $includeName, $data) |
|
73 | + protected function callIncludeMethod( Scope $scope, $includeName, $data ) |
|
74 | 74 | { |
75 | - if ($includeName === 'pivot') { |
|
76 | - return $this->includePivot($data->$includeName); |
|
75 | + if ( $includeName === 'pivot' ) { |
|
76 | + return $this->includePivot( $data->$includeName ); |
|
77 | 77 | } |
78 | 78 | |
79 | - $params = $scope->getManager()->getIncludeParams($scope->getIdentifier($includeName)); |
|
79 | + $params = $scope->getManager()->getIncludeParams( $scope->getIdentifier( $includeName ) ); |
|
80 | 80 | |
81 | - if (method_exists($this, $includeName)) { |
|
82 | - return call_user_func([$this, $includeName], $data, $params); |
|
81 | + if ( method_exists( $this, $includeName ) ) { |
|
82 | + return call_user_func( [ $this, $includeName ], $data, $params ); |
|
83 | 83 | } else { |
84 | - return app(Responder::class)->transform($data->$includeName)->getResource(); |
|
84 | + return app( Responder::class )->transform( $data->$includeName )->getResource(); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * @param Pivot $pivot |
92 | 92 | * @return \League\Fractal\Resource\ResourceInterface|bool |
93 | 93 | */ |
94 | - protected function includePivot(Pivot $pivot) |
|
94 | + protected function includePivot( Pivot $pivot ) |
|
95 | 95 | { |
96 | - if (! method_exists($this, 'transformPivot')) { |
|
96 | + if ( ! method_exists( $this, 'transformPivot' ) ) { |
|
97 | 97 | return false; |
98 | 98 | } |
99 | 99 | |
100 | - return app(Responder::class)->transform($pivot, function ($pivot) { |
|
101 | - return $this->transformPivot($pivot); |
|
100 | + return app( Responder::class )->transform( $pivot, function ( $pivot ) { |
|
101 | + return $this->transformPivot( $pivot ); |
|
102 | 102 | })->getResource(); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | \ No newline at end of file |