{"action":"created","comment":{"url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/comments/79286076","id":79286076,"diff_hunk":"@@ -46,9 +46,22 @@ public function index()\n         $sorting = $apiRequest->getSort();\n         $included = $apiRequest->getIncludedRelationships();\n         $filters = $apiRequest->getFilters();\n-\n+        \n+        //HACK: JsonAPI is specifying this as an array but it should be a string at this point for RQL processing.\n+        switch(count($filters)){\n+        \tcase 0:\n+        \t\t$filters = null;\n+        \t\tbreak;","path":"src/NilPortugues/Laravel5/JsonApi/Controller/JsonApiController.php","position":10,"original_position":10,"commit_id":"3642bf6de60ab85013484ea36bca872a0b906cdc","original_commit_id":"3642bf6de60ab85013484ea36bca872a0b906cdc","user":{"login":"Nitpick-CI","id":12626182,"avatar_url":"https://avatars.githubusercontent.com/u/12626182?v=3","gravatar_id":"","url":"https://api.github.com/users/Nitpick-CI","html_url":"https://github.com/Nitpick-CI","followers_url":"https://api.github.com/users/Nitpick-CI/followers","following_url":"https://api.github.com/users/Nitpick-CI/following{/other_user}","gists_url":"https://api.github.com/users/Nitpick-CI/gists{/gist_id}","starred_url":"https://api.github.com/users/Nitpick-CI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nitpick-CI/subscriptions","organizations_url":"https://api.github.com/users/Nitpick-CI/orgs","repos_url":"https://api.github.com/users/Nitpick-CI/repos","events_url":"https://api.github.com/users/Nitpick-CI/events{/privacy}","received_events_url":"https://api.github.com/users/Nitpick-CI/received_events","type":"User","site_admin":false},"body":"Spaces must be used to indent lines; tabs are not allowed","created_at":"2016-09-17T15:16:56Z","updated_at":"2016-09-17T15:16:56Z","html_url":"https://github.com/nilportugues/laravel5-jsonapi/pull/99#discussion_r79286076","pull_request_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/99","_links":{"self":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/comments/79286076"},"html":{"href":"https://github.com/nilportugues/laravel5-jsonapi/pull/99#discussion_r79286076"},"pull_request":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/99"}}},"pull_request":{"url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/99","id":85677126,"html_url":"https://github.com/nilportugues/laravel5-jsonapi/pull/99","diff_url":"https://github.com/nilportugues/laravel5-jsonapi/pull/99.diff","patch_url":"https://github.com/nilportugues/laravel5-jsonapi/pull/99.patch","issue_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/issues/99","number":99,"state":"open","locked":false,"title":"Filtering","user":{"login":"srottem","id":426295,"avatar_url":"https://avatars.githubusercontent.com/u/426295?v=3","gravatar_id":"","url":"https://api.github.com/users/srottem","html_url":"https://github.com/srottem","followers_url":"https://api.github.com/users/srottem/followers","following_url":"https://api.github.com/users/srottem/following{/other_user}","gists_url":"https://api.github.com/users/srottem/gists{/gist_id}","starred_url":"https://api.github.com/users/srottem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srottem/subscriptions","organizations_url":"https://api.github.com/users/srottem/orgs","repos_url":"https://api.github.com/users/srottem/repos","events_url":"https://api.github.com/users/srottem/events{/privacy}","received_events_url":"https://api.github.com/users/srottem/received_events","type":"User","site_admin":false},"body":"Hi Nil,\r\n\r\nI've been working up a filtering scheme that uses RQL in the filter request parameter to populate the eloquent query with where clauses.  For example, the request string could contain something like the following:\r\n\r\nfilter=and(or(and(like(name,b*),ne(name,bob),like(name,a)),eq(size,10))\r\n\r\nThere are other ways of expressing this using RQL, but this will do for an example. \r\n\r\nThe implementation I've thrown together is using the xiag-ag/rql-parser (https://github.com/xiag-ag/rql-parser)  to parse the content of the filter parameter passed on in the request string and then uses a class I've added named EloquentNodeVisitor to add where clauses to the eloquent query builder.\r\n\r\nMy implementation does kind of break your approach to handling the filter parameter (based, I assume on the recommendation on the jsonapi website) since I want to have a single RQL filter rather than a filter per field. Since the current implementation of your json-api package exposes the filter through the Request->getFilters and this always returns an array it posed an issue with obtaining the RQL and still getting correctly formed links in the response.  As a workaround the JsonApiController now converts the result from getFilters to a string or a null - it might be better to change this in the json-api package instead but I didn't know whether this approach made sense to you so I've just hacked it for now.\r\n\r\nOne final note - RQL supports a \"not\" logical operator but I couldn't figure out any way to map it to the Eloquent query builder so it will be rejected at this stage.\r\n\r\nLet me know if you want anything further clarified.\r\n\r\nSymon.\r\n","created_at":"2016-09-17T15:16:47Z","updated_at":"2016-09-17T15:16:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"baf2b4f045439bdbe75a6e365b1a8f3a7bf8de1b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/99/commits","review_comments_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/99/comments","review_comment_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/issues/99/comments","statuses_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/statuses/3642bf6de60ab85013484ea36bca872a0b906cdc","head":{"label":"srottem:master","ref":"master","sha":"3642bf6de60ab85013484ea36bca872a0b906cdc","user":{"login":"srottem","id":426295,"avatar_url":"https://avatars.githubusercontent.com/u/426295?v=3","gravatar_id":"","url":"https://api.github.com/users/srottem","html_url":"https://github.com/srottem","followers_url":"https://api.github.com/users/srottem/followers","following_url":"https://api.github.com/users/srottem/following{/other_user}","gists_url":"https://api.github.com/users/srottem/gists{/gist_id}","starred_url":"https://api.github.com/users/srottem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srottem/subscriptions","organizations_url":"https://api.github.com/users/srottem/orgs","repos_url":"https://api.github.com/users/srottem/repos","events_url":"https://api.github.com/users/srottem/events{/privacy}","received_events_url":"https://api.github.com/users/srottem/received_events","type":"User","site_admin":false},"repo":{"id":65238095,"name":"laravel5-jsonapi","full_name":"srottem/laravel5-jsonapi","owner":{"login":"srottem","id":426295,"avatar_url":"https://avatars.githubusercontent.com/u/426295?v=3","gravatar_id":"","url":"https://api.github.com/users/srottem","html_url":"https://github.com/srottem","followers_url":"https://api.github.com/users/srottem/followers","following_url":"https://api.github.com/users/srottem/following{/other_user}","gists_url":"https://api.github.com/users/srottem/gists{/gist_id}","starred_url":"https://api.github.com/users/srottem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srottem/subscriptions","organizations_url":"https://api.github.com/users/srottem/orgs","repos_url":"https://api.github.com/users/srottem/repos","events_url":"https://api.github.com/users/srottem/events{/privacy}","received_events_url":"https://api.github.com/users/srottem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/srottem/laravel5-jsonapi","description":"Laravel 5 JSON API Transformer Package","fork":true,"url":"https://api.github.com/repos/srottem/laravel5-jsonapi","forks_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/forks","keys_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/teams","hooks_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/hooks","issue_events_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/issues/events{/number}","events_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/events","assignees_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/assignees{/user}","branches_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/branches{/branch}","tags_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/tags","blobs_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/statuses/{sha}","languages_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/languages","stargazers_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/stargazers","contributors_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/contributors","subscribers_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/subscribers","subscription_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/subscription","commits_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/contents/{+path}","compare_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/merges","archive_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/downloads","issues_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/issues{/number}","pulls_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/pulls{/number}","milestones_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/milestones{/number}","notifications_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/labels{/name}","releases_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/releases{/id}","deployments_url":"https://api.github.com/repos/srottem/laravel5-jsonapi/deployments","created_at":"2016-08-08T20:46:56Z","updated_at":"2016-08-08T20:46:57Z","pushed_at":"2016-09-17T12:16:32Z","git_url":"git://github.com/srottem/laravel5-jsonapi.git","ssh_url":"git@github.com:srottem/laravel5-jsonapi.git","clone_url":"https://github.com/srottem/laravel5-jsonapi.git","svn_url":"https://github.com/srottem/laravel5-jsonapi","homepage":"http://nilportugues.com","size":552,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nilportugues:master","ref":"master","sha":"6ad0a971907abc8b5dd3ebbc3c9e92ec37196268","user":{"login":"nilportugues","id":550948,"avatar_url":"https://avatars.githubusercontent.com/u/550948?v=3","gravatar_id":"","url":"https://api.github.com/users/nilportugues","html_url":"https://github.com/nilportugues","followers_url":"https://api.github.com/users/nilportugues/followers","following_url":"https://api.github.com/users/nilportugues/following{/other_user}","gists_url":"https://api.github.com/users/nilportugues/gists{/gist_id}","starred_url":"https://api.github.com/users/nilportugues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilportugues/subscriptions","organizations_url":"https://api.github.com/users/nilportugues/orgs","repos_url":"https://api.github.com/users/nilportugues/repos","events_url":"https://api.github.com/users/nilportugues/events{/privacy}","received_events_url":"https://api.github.com/users/nilportugues/received_events","type":"User","site_admin":false},"repo":{"id":40797469,"name":"laravel5-jsonapi","full_name":"nilportugues/laravel5-jsonapi","owner":{"login":"nilportugues","id":550948,"avatar_url":"https://avatars.githubusercontent.com/u/550948?v=3","gravatar_id":"","url":"https://api.github.com/users/nilportugues","html_url":"https://github.com/nilportugues","followers_url":"https://api.github.com/users/nilportugues/followers","following_url":"https://api.github.com/users/nilportugues/following{/other_user}","gists_url":"https://api.github.com/users/nilportugues/gists{/gist_id}","starred_url":"https://api.github.com/users/nilportugues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilportugues/subscriptions","organizations_url":"https://api.github.com/users/nilportugues/orgs","repos_url":"https://api.github.com/users/nilportugues/repos","events_url":"https://api.github.com/users/nilportugues/events{/privacy}","received_events_url":"https://api.github.com/users/nilportugues/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nilportugues/laravel5-jsonapi","description":"Laravel 5 JSON API Transformer Package","fork":false,"url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi","forks_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/forks","keys_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/teams","hooks_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/hooks","issue_events_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/issues/events{/number}","events_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/events","assignees_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/assignees{/user}","branches_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/branches{/branch}","tags_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/tags","blobs_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/git/refs{/sha}","trees_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/statuses/{sha}","languages_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/languages","stargazers_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/stargazers","contributors_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/contributors","subscribers_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/subscribers","subscription_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/subscription","commits_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/commits{/sha}","git_commits_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/git/commits{/sha}","comments_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/comments{/number}","issue_comment_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/issues/comments{/number}","contents_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/contents/{+path}","compare_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/merges","archive_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/downloads","issues_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/issues{/number}","pulls_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls{/number}","milestones_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/milestones{/number}","notifications_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/labels{/name}","releases_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/releases{/id}","deployments_url":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/deployments","created_at":"2015-08-16T03:25:54Z","updated_at":"2016-09-13T15:27:31Z","pushed_at":"2016-09-17T15:16:47Z","git_url":"git://github.com/nilportugues/laravel5-jsonapi.git","ssh_url":"git@github.com:nilportugues/laravel5-jsonapi.git","clone_url":"https://github.com/nilportugues/laravel5-jsonapi.git","svn_url":"https://github.com/nilportugues/laravel5-jsonapi","homepage":"http://nilportugues.com","size":554,"stargazers_count":171,"watchers_count":171,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":17,"forks":40,"open_issues":17,"watchers":171,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/99"},"html":{"href":"https://github.com/nilportugues/laravel5-jsonapi/pull/99"},"issue":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/issues/99"},"comments":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/nilportugues/laravel5-jsonapi/statuses/3642bf6de60ab85013484ea36bca872a0b906cdc"}}}}
{"actor":{"display_login":"Nitpick-CI"}}