{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/laravel-fractal/issues/113","repository_url":"https://api.github.com/repos/spatie/laravel-fractal","labels_url":"https://api.github.com/repos/spatie/laravel-fractal/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-fractal/issues/113/comments","events_url":"https://api.github.com/repos/spatie/laravel-fractal/issues/113/events","html_url":"https://github.com/spatie/laravel-fractal/issues/113","id":231252901,"number":113,"title":"How to reorder `data` and `meta` ?","user":{"login":"kamrava","id":5755992,"avatar_url":"https://avatars3.githubusercontent.com/u/5755992?v=3","gravatar_id":"","url":"https://api.github.com/users/kamrava","html_url":"https://github.com/kamrava","followers_url":"https://api.github.com/users/kamrava/followers","following_url":"https://api.github.com/users/kamrava/following{/other_user}","gists_url":"https://api.github.com/users/kamrava/gists{/gist_id}","starred_url":"https://api.github.com/users/kamrava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kamrava/subscriptions","organizations_url":"https://api.github.com/users/kamrava/orgs","repos_url":"https://api.github.com/users/kamrava/repos","events_url":"https://api.github.com/users/kamrava/events{/privacy}","received_events_url":"https://api.github.com/users/kamrava/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-25T06:31:25Z","updated_at":"2017-05-25T06:51:16Z","closed_at":null,"body":"The default result is like this:\r\n```\r\n{\r\n  \"data\": [\r\n    {\r\n      \"id\": 1,\r\n      \"line_id\": 8\r\n    },\r\n    {\r\n      \"id\": 2,\r\n      \"line_id\": 4\r\n    },\r\n    {\r\n      \"id\": 3,\r\n      \"line_id\": 17\r\n    }\r\n  ],\r\n  \"meta\": {\r\n    \"status\": 200,\r\n    \"message\": \"OK\"\r\n  }\r\n}\r\n```\r\n\r\nI want this be like this:\r\n```\r\n{\r\n  \"meta\": {\r\n    \"status\": 200,\r\n    \"message\": \"OK\"\r\n  },\r\n  \"data\": [\r\n    {\r\n      \"id\": 1,\r\n      \"line_id\": 8\r\n    },\r\n    {\r\n      \"id\": 2,\r\n      \"line_id\": 4\r\n    },\r\n    {\r\n      \"id\": 3,\r\n      \"line_id\": 17\r\n    }\r\n  ]\r\n}\r\n```\r\nAny ideas?"},"comment":{"url":"https://api.github.com/repos/spatie/laravel-fractal/issues/comments/303937530","html_url":"https://github.com/spatie/laravel-fractal/issues/113#issuecomment-303937530","issue_url":"https://api.github.com/repos/spatie/laravel-fractal/issues/113","id":303937530,"user":{"login":"DCzajkowski","id":4501047,"avatar_url":"https://avatars2.githubusercontent.com/u/4501047?v=3","gravatar_id":"","url":"https://api.github.com/users/DCzajkowski","html_url":"https://github.com/DCzajkowski","followers_url":"https://api.github.com/users/DCzajkowski/followers","following_url":"https://api.github.com/users/DCzajkowski/following{/other_user}","gists_url":"https://api.github.com/users/DCzajkowski/gists{/gist_id}","starred_url":"https://api.github.com/users/DCzajkowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DCzajkowski/subscriptions","organizations_url":"https://api.github.com/users/DCzajkowski/orgs","repos_url":"https://api.github.com/users/DCzajkowski/repos","events_url":"https://api.github.com/users/DCzajkowski/events{/privacy}","received_events_url":"https://api.github.com/users/DCzajkowski/received_events","type":"User","site_admin":false},"created_at":"2017-05-25T06:51:16Z","updated_at":"2017-05-25T06:51:16Z","body":"You cannot. The `toArray()` method (`League\\Fractal\\Scope@253`) uses:\r\n```php\r\nreturn array_merge($data, $meta);\r\n```\r\nWhich basically adds meta at the end. If you really want it to be at the top, you can fork the original `League\\Fractal` repo, edit it and substitute in your `composer.json` file."}}
{"actor":{"display_login":"DCzajkowski"}}