@@ -80,14 +80,18 @@ public function toArray($request): array
8080 public function getResourceData ($ request ): array
8181 {
8282 if (empty ($ this ->data )) {
83- $ this ->data = array_filter ([
84- 'id ' => $ this ->getId (),
85- 'type ' => $ this ->getType (),
86- 'attributes ' => $ this ->getAttributes ($ request ),
87- 'relationships ' => empty ($ this ->relationshipReferences ) ? $ this ->resolveRelationships ($ request ) : $ this ->relationshipReferences ,
88- 'meta ' => $ this ->getMeta ($ request ),
89- 'links ' => $ this ->getLinks ($ request ),
90- ], fn ($ value ) => ! empty ($ value ));
83+ $ this ->data = array_filter (
84+ [
85+ 'id ' => $ this ->getId (),
86+ 'type ' => $ this ->getType (),
87+ 'attributes ' => $ this ->getAttributes ($ request ),
88+ 'relationships ' => empty ($ this ->relationshipReferences ) ? $ this ->resolveRelationships ($ request ) : $ this ->relationshipReferences ,
89+ 'meta ' => $ this ->getMeta ($ request ),
90+ 'links ' => $ this ->getLinks ($ request ),
91+ ],
92+ fn ($ value , $ key ) => $ key === 'attributes ' || ! empty ($ value ),
93+ ARRAY_FILTER_USE_BOTH
94+ );
9195 }
9296
9397 return $ this ->data ;
0 commit comments