{"action":"closed","issue":{"url":"https://api.github.com/repos/spatie/laravel-fractal/issues/44","repository_url":"https://api.github.com/repos/spatie/laravel-fractal","labels_url":"https://api.github.com/repos/spatie/laravel-fractal/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-fractal/issues/44/comments","events_url":"https://api.github.com/repos/spatie/laravel-fractal/issues/44/events","html_url":"https://github.com/spatie/laravel-fractal/issues/44","id":179300035,"number":44,"title":"Naming outer resource only","user":{"login":"JadoJodo","id":534276,"avatar_url":"https://avatars.githubusercontent.com/u/534276?v=3","gravatar_id":"","url":"https://api.github.com/users/JadoJodo","html_url":"https://github.com/JadoJodo","followers_url":"https://api.github.com/users/JadoJodo/followers","following_url":"https://api.github.com/users/JadoJodo/following{/other_user}","gists_url":"https://api.github.com/users/JadoJodo/gists{/gist_id}","starred_url":"https://api.github.com/users/JadoJodo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JadoJodo/subscriptions","organizations_url":"https://api.github.com/users/JadoJodo/orgs","repos_url":"https://api.github.com/users/JadoJodo/repos","events_url":"https://api.github.com/users/JadoJodo/events{/privacy}","received_events_url":"https://api.github.com/users/JadoJodo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-26T18:16:24Z","updated_at":"2016-09-29T12:31:19Z","closed_at":"2016-09-29T12:31:19Z","body":"I'm building an API using Dingo and using this library to transform the data. I've got it working as I need to, with one (major) caveat: Some of the responses use a root resource name, some do not. An example of the root:\r\n\r\n```php\r\nreturn fractal()\r\n            ->collection($activityFeedItems)\r\n            ->transformWith(new ActivityFeedTransformer())\r\n            ->parseIncludes(['user', 'taggedUsers', 'userPhotos'])\r\n            ->resourceName('activityfeed_items')\r\n            ->toArray();\r\n```\r\n\r\nWhen I include the `taggedUsers`, `userPhotos`, etc, they are then wrapped in a `data` resouce name. This is unwanted. How can I specify a custom resource name for the root, but ignore for any includes?\r\n\r\nAn include example:\r\n\r\n```php\r\n$userPhotos = $activityFeedItem->userPhotos;\r\n\r\n        if (!$userPhotos)\r\n            return [];\r\n\r\n        return $this->collection($userPhotos, new UserPhotoTransformer());\r\n```"}}
{"actor":{"display_login":"sebastiandedeyne"}}