{"action":"closed","issue":{"url":"https://api.github.com/repos/dingo/api/issues/507","labels_url":"https://api.github.com/repos/dingo/api/issues/507/labels{/name}","comments_url":"https://api.github.com/repos/dingo/api/issues/507/comments","events_url":"https://api.github.com/repos/dingo/api/issues/507/events","html_url":"https://github.com/dingo/api/issues/507","id":93190701,"number":507,"title":"lumen,transformer does'n work","user":{"login":"vanntian","id":10600430,"avatar_url":"https://avatars.githubusercontent.com/u/10600430?v=3","gravatar_id":"","url":"https://api.github.com/users/vanntian","html_url":"https://github.com/vanntian","followers_url":"https://api.github.com/users/vanntian/followers","following_url":"https://api.github.com/users/vanntian/following{/other_user}","gists_url":"https://api.github.com/users/vanntian/gists{/gist_id}","starred_url":"https://api.github.com/users/vanntian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vanntian/subscriptions","organizations_url":"https://api.github.com/users/vanntian/orgs","repos_url":"https://api.github.com/users/vanntian/repos","events_url":"https://api.github.com/users/vanntian/events{/privacy}","received_events_url":"https://api.github.com/users/vanntian/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-06T05:13:24Z","updated_at":"2015-07-17T11:37:15Z","closed_at":"2015-07-17T11:37:15Z","body":"bootstrap.php:\r\n```php\r\n$app->register(Dingo\\Api\\Provider\\LumenServiceProvider::class);\r\n$app['Dingo\\Api\\Transformer\\Factory']->setAdapter(function ($app) {\r\n    return new Dingo\\Api\\Transformer\\Adapter\\Fractal(new League\\Fractal\\Manager, 'include', ',');\r\n});\r\n```\r\nController.php:\r\n```php\r\nuse Dingo\\Api\\Routing\\Helpers;\r\nuse Laravel\\Lumen\\Routing\\Controller as BaseController;\r\n\r\nclass Controller extends BaseController\r\n{\r\n    use Helpers;\r\n}\r\n```\r\nCategoryTransformer.php:\r\n```php\r\nclass CategoryTransformer extends TransformerAbstract\r\n{\r\n    /**\r\n     * 格式转换\r\n     * @param Category $category\r\n     * @return array\r\n     */\r\n    public function transform(Category $category)\r\n    {\r\n        return [\r\n            'id' => $category->id,\r\n            'name' => $category->name,\r\n            'sort' => $category->sort,\r\n            'is-show' => $category->is_show\r\n        ];\r\n    }\r\n}\r\n```\r\nCategoryController.php:\r\n```php\r\npublic function index()\r\n{\r\n        $category = Category::cacheRememberForever()->get();\r\n\r\n        return $this->collection($category, new CategoryTransformer);\r\n}\r\n```\r\nthe result:\r\n```\r\n[\r\n    {\r\n        \"id\": 1,\r\n        \"name\": \"婚恋\",\r\n        \"sort\": 2,\r\n        \"is_show\": true,\r\n        \"created_at\": \"2015-07-04 18:47:36\",\r\n        \"updated_at\": \"2015-07-04 18:47:36\"\r\n    }\r\n]\r\n```\r\n\r\ndoes't work"}}