{"action":"created","issue":{"url":"https://api.github.com/repos/czim/laravel-filter/issues/4","repository_url":"https://api.github.com/repos/czim/laravel-filter","labels_url":"https://api.github.com/repos/czim/laravel-filter/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/czim/laravel-filter/issues/4/comments","events_url":"https://api.github.com/repos/czim/laravel-filter/issues/4/events","html_url":"https://github.com/czim/laravel-filter/issues/4","id":157342088,"number":4,"title":"CountableFilters data array access","user":{"login":"a-komarev","id":1849174,"avatar_url":"https://avatars.githubusercontent.com/u/1849174?v=3","gravatar_id":"","url":"https://api.github.com/users/a-komarev","html_url":"https://github.com/a-komarev","followers_url":"https://api.github.com/users/a-komarev/followers","following_url":"https://api.github.com/users/a-komarev/following{/other_user}","gists_url":"https://api.github.com/users/a-komarev/gists{/gist_id}","starred_url":"https://api.github.com/users/a-komarev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-komarev/subscriptions","organizations_url":"https://api.github.com/users/a-komarev/orgs","repos_url":"https://api.github.com/users/a-komarev/repos","events_url":"https://api.github.com/users/a-komarev/events{/privacy}","received_events_url":"https://api.github.com/users/a-komarev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-28T14:49:49Z","updated_at":"2016-05-28T17:15:49Z","closed_at":null,"body":"If filter countable has multi dimensional array in it:\r\n```php\r\n$filterCounters->get('age_groups');\r\n\r\n// OUTPUT\r\n[\r\n    '14-25' => 1,\r\n    '26-30' => 5,\r\n    '31-40' => 14,\r\n    '41-50' => 10,\r\n]\r\n```\r\n\r\nIt could be accessed like: `$filterCounters->get('age_groups')['14-25'];`\r\n\r\nBut if there is no such key in array - template will return an exception, and there is a need to `isset()` checks in template and they started to smell a lot.\r\n\r\nIt would be great to have laravel way syntax for the array data access:\r\n\r\n```php\r\n$filterCounters->get('age_groups.14-25');\r\n```\r\n\r\nOr am I doing it wrong and each age range should be fetched separately? If so, there would be much more than 500 counters in current app :'(\r\n\r\nOutput result should be like this:\r\n\r\n![selection_134](https://cloud.githubusercontent.com/assets/1849174/15627936/c9595e72-2504-11e6-812c-d70f8f1bea16.png)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/czim/laravel-filter/issues/comments/222319327","html_url":"https://github.com/czim/laravel-filter/issues/4#issuecomment-222319327","issue_url":"https://api.github.com/repos/czim/laravel-filter/issues/4","id":222319327,"user":{"login":"czim","id":11831617,"avatar_url":"https://avatars.githubusercontent.com/u/11831617?v=3","gravatar_id":"","url":"https://api.github.com/users/czim","html_url":"https://github.com/czim","followers_url":"https://api.github.com/users/czim/followers","following_url":"https://api.github.com/users/czim/following{/other_user}","gists_url":"https://api.github.com/users/czim/gists{/gist_id}","starred_url":"https://api.github.com/users/czim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czim/subscriptions","organizations_url":"https://api.github.com/users/czim/orgs","repos_url":"https://api.github.com/users/czim/repos","events_url":"https://api.github.com/users/czim/events{/privacy}","received_events_url":"https://api.github.com/users/czim/received_events","type":"User","site_admin":false},"created_at":"2016-05-28T17:15:49Z","updated_at":"2016-05-28T17:15:49Z","body":"`CountableResults` is a [Laravel `Collection`](https://laravel.com/docs/5.2/eloquent-collections), so you can use any of its typical access methods to get details. For nested data, it depends on how you handle the Countable implementation. \r\n\r\nThe provided `SimpleDistinctValue` counting strategy returns a QueryBuilder `lists()` return value, which is a simple array in Laravel 5.1.\r\n\r\nOne solution might be to perform a `toArray()` on the `CountableResults`, so you can use `array_get()` and other dot notation methods. Another is to roll your own counting strategies, which return collections or data objects that may help you to return default data without requiring isset() checks."}}
{"actor":{"display_login":"czim"}}