{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/22872","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/22872/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/22872/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/22872/events","html_url":"https://github.com/laravel/framework/pull/22872","id":290244977,"number":22872,"title":"[5.5] PR to merge for `Resource` class with User's preference to pass the method name, customize link url and meta.","user":{"login":"ssi-anik","id":2676602,"avatar_url":"https://avatars1.githubusercontent.com/u/2676602?v=4","gravatar_id":"","url":"https://api.github.com/users/ssi-anik","html_url":"https://github.com/ssi-anik","followers_url":"https://api.github.com/users/ssi-anik/followers","following_url":"https://api.github.com/users/ssi-anik/following{/other_user}","gists_url":"https://api.github.com/users/ssi-anik/gists{/gist_id}","starred_url":"https://api.github.com/users/ssi-anik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssi-anik/subscriptions","organizations_url":"https://api.github.com/users/ssi-anik/orgs","repos_url":"https://api.github.com/users/ssi-anik/repos","events_url":"https://api.github.com/users/ssi-anik/events{/privacy}","received_events_url":"https://api.github.com/users/ssi-anik/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-01-21T03:59:16Z","updated_at":"2018-02-03T04:37:07Z","closed_at":"2018-01-21T16:47:23Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/22872","html_url":"https://github.com/laravel/framework/pull/22872","diff_url":"https://github.com/laravel/framework/pull/22872.diff","patch_url":"https://github.com/laravel/framework/pull/22872.patch"},"body":"After merging this PR, the users of the framework will be able to achieve the following facilities.\r\n1.  Previously, For a `Resource` or `ResourceCollection` class, the user had to write his transformations inside the `toArray` method. If the user wanted to shrink the object, he had to create another class. Now, they can pass the *method name* when creating the objects. like \r\n`return new UserResource(User::find(10), 'shortInfo');` . short info **SHOULD BE** present inside the `UserResource` class. The same can be done for the `ResourceCollection` too.\r\n2. After merging the code, User will have the ability to customize their `links`. The `links` method must be present inside the **extension** of `ResourceCollection` class.\r\n3. If the user wants to remove the `meta` key from his collection, he __can NOW__ return `null` from `ResourceCollection::meta` method. Meta method doesn't exist in the `ResourceCollection` class. If he wants to **override** the default meta-data, he can set his own inside the `meta` method of his own class. In other cases, the frameworks metadata will be loaded."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/362779288","html_url":"https://github.com/laravel/framework/pull/22872#issuecomment-362779288","issue_url":"https://api.github.com/repos/laravel/framework/issues/22872","id":362779288,"user":{"login":"ssi-anik","id":2676602,"avatar_url":"https://avatars1.githubusercontent.com/u/2676602?v=4","gravatar_id":"","url":"https://api.github.com/users/ssi-anik","html_url":"https://github.com/ssi-anik","followers_url":"https://api.github.com/users/ssi-anik/followers","following_url":"https://api.github.com/users/ssi-anik/following{/other_user}","gists_url":"https://api.github.com/users/ssi-anik/gists{/gist_id}","starred_url":"https://api.github.com/users/ssi-anik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssi-anik/subscriptions","organizations_url":"https://api.github.com/users/ssi-anik/orgs","repos_url":"https://api.github.com/users/ssi-anik/repos","events_url":"https://api.github.com/users/ssi-anik/events{/privacy}","received_events_url":"https://api.github.com/users/ssi-anik/received_events","type":"User","site_admin":false},"created_at":"2018-02-03T04:37:07Z","updated_at":"2018-02-03T04:37:07Z","author_association":"NONE","body":"@acodercat in short, most probably there is a `withResponse` method. from there you will have to unset the `meta' key. "}}
{"actor":{"display_login":"ssi-anik"}}