{"action":"created","issue":{"url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/136","repository_url":"https://api.github.com/repos/Laravel-Backpack/CRUD","labels_url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/136/comments","events_url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/136/events","html_url":"https://github.com/Laravel-Backpack/CRUD/pull/136","id":179087134,"number":136,"title":"Enable unicity checks to crud resources","user":{"login":"OwenMelbz","id":1094740,"avatar_url":"https://avatars.githubusercontent.com/u/1094740?v=3","gravatar_id":"","url":"https://api.github.com/users/OwenMelbz","html_url":"https://github.com/OwenMelbz","followers_url":"https://api.github.com/users/OwenMelbz/followers","following_url":"https://api.github.com/users/OwenMelbz/following{/other_user}","gists_url":"https://api.github.com/users/OwenMelbz/gists{/gist_id}","starred_url":"https://api.github.com/users/OwenMelbz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OwenMelbz/subscriptions","organizations_url":"https://api.github.com/users/OwenMelbz/orgs","repos_url":"https://api.github.com/users/OwenMelbz/repos","events_url":"https://api.github.com/users/OwenMelbz/events{/privacy}","received_events_url":"https://api.github.com/users/OwenMelbz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Laravel-Backpack/CRUD/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/Laravel-Backpack/CRUD/labels/ready","name":"ready","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-25T13:49:58Z","updated_at":"2016-09-26T10:02:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Laravel-Backpack/CRUD/pulls/136","html_url":"https://github.com/Laravel-Backpack/CRUD/pull/136","diff_url":"https://github.com/Laravel-Backpack/CRUD/pull/136.diff","patch_url":"https://github.com/Laravel-Backpack/CRUD/pull/136.patch"},"body":"**summary**\r\nEnables fields to be marked as unique, giving the user visual feedback as they type, with an optional hint\r\n\r\n**preview**\r\n![unique fields](https://cloud.githubusercontent.com/assets/1094740/18815738/f42ff52c-8330-11e6-8c1e-9efb45a3254b.gif)\r\n\r\n\r\n**usage**\r\n\r\n```php\r\n$this->crud->addField([\r\n            'label' => 'Product Slug',\r\n            'name' => 'slug',\r\n            'unique' => true, //enables unicity checks when typing\r\n            'unique_hint' => 'slug' //(optional) the name of the field to display for the hint, if empty no hint will show\r\n        ]);\r\n\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/comments/249529490","html_url":"https://github.com/Laravel-Backpack/CRUD/pull/136#issuecomment-249529490","issue_url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/136","id":249529490,"user":{"login":"OwenMelbz","id":1094740,"avatar_url":"https://avatars.githubusercontent.com/u/1094740?v=3","gravatar_id":"","url":"https://api.github.com/users/OwenMelbz","html_url":"https://github.com/OwenMelbz","followers_url":"https://api.github.com/users/OwenMelbz/followers","following_url":"https://api.github.com/users/OwenMelbz/following{/other_user}","gists_url":"https://api.github.com/users/OwenMelbz/gists{/gist_id}","starred_url":"https://api.github.com/users/OwenMelbz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OwenMelbz/subscriptions","organizations_url":"https://api.github.com/users/OwenMelbz/orgs","repos_url":"https://api.github.com/users/OwenMelbz/repos","events_url":"https://api.github.com/users/OwenMelbz/events{/privacy}","received_events_url":"https://api.github.com/users/OwenMelbz/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T10:02:49Z","updated_at":"2016-09-26T10:02:49Z","body":"Problem 5 eh? Jumping 4? :D\r\n\r\nI did actually think about making it more generic so you pass the method/route to check, which would be a nice feature, however I found unique checks were as far as I'd needed to go, with things like usernames, urls, emails, access codes, api keys etc etc. \r\n\r\nMaybe if it's implemented in such a way that allows the future possibilities it would be nice, just start with a generic \r\n\r\n```php\r\n$this->crud->addField([\r\n            'label' => 'Product Slug',\r\n            'name' => 'slug',\r\n            'type' => 'text',\r\n            'ajaxCheck' => 'unique',\r\n            'ajaxCheckErrorMessage' => 'This slug already exists',\r\n        ]);\r\n```\r\n\r\nwhich intern hits `/controller/ajaxCheck/{{$field['ajaxCheck'}}` allowing the user to define a custom one, then we can build in 'unique' as the default"}}
{"actor":{"display_login":"OwenMelbz"}}