{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/ideas/issues/1115","repository_url":"https://api.github.com/repos/laravel/ideas","labels_url":"https://api.github.com/repos/laravel/ideas/issues/1115/labels{/name}","comments_url":"https://api.github.com/repos/laravel/ideas/issues/1115/comments","events_url":"https://api.github.com/repos/laravel/ideas/issues/1115/events","html_url":"https://github.com/laravel/ideas/issues/1115","id":313575455,"number":1115,"title":"Implement slug on Validator?","user":{"login":"caiokawasaki","id":9747004,"avatar_url":"https://avatars2.githubusercontent.com/u/9747004?v=4","gravatar_id":"","url":"https://api.github.com/users/caiokawasaki","html_url":"https://github.com/caiokawasaki","followers_url":"https://api.github.com/users/caiokawasaki/followers","following_url":"https://api.github.com/users/caiokawasaki/following{/other_user}","gists_url":"https://api.github.com/users/caiokawasaki/gists{/gist_id}","starred_url":"https://api.github.com/users/caiokawasaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caiokawasaki/subscriptions","organizations_url":"https://api.github.com/users/caiokawasaki/orgs","repos_url":"https://api.github.com/users/caiokawasaki/repos","events_url":"https://api.github.com/users/caiokawasaki/events{/privacy}","received_events_url":"https://api.github.com/users/caiokawasaki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-12T04:46:55Z","updated_at":"2018-04-12T14:47:53Z","closed_at":null,"author_association":"NONE","body":"In all my projects I implement the following code to validate slugs:\r\n\r\n`<?php\r\n\r\nnamespace App\\Providers;\r\n\r\nuse Illuminate\\Support\\ServiceProvider;\r\nuse Illuminate\\Support\\Facades\\Validator;\r\n\r\nclass AppServiceProvider extends ServiceProvider\r\n{\r\n    /**\r\n     * Bootstrap any application services.\r\n     *\r\n     * @return void\r\n     */\r\n    public function boot()\r\n    {\r\n        Validator::extend('slug', function($attribute, $value, $parameters, $validator) {\r\n            return preg_match('/^[a-z0-9]+(?:-[a-z0-9]+)*$/', $value);\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Register any application services.\r\n     *\r\n     * @return void\r\n     */\r\n    public function register()\r\n    {\r\n        //\r\n    }\r\n}`\r\n\r\nIt would be good if the slug validation was a standard feature, would not it?"},"comment":{"url":"https://api.github.com/repos/laravel/ideas/issues/comments/380832172","html_url":"https://github.com/laravel/ideas/issues/1115#issuecomment-380832172","issue_url":"https://api.github.com/repos/laravel/ideas/issues/1115","id":380832172,"user":{"login":"drbyte","id":404472,"avatar_url":"https://avatars0.githubusercontent.com/u/404472?v=4","gravatar_id":"","url":"https://api.github.com/users/drbyte","html_url":"https://github.com/drbyte","followers_url":"https://api.github.com/users/drbyte/followers","following_url":"https://api.github.com/users/drbyte/following{/other_user}","gists_url":"https://api.github.com/users/drbyte/gists{/gist_id}","starred_url":"https://api.github.com/users/drbyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drbyte/subscriptions","organizations_url":"https://api.github.com/users/drbyte/orgs","repos_url":"https://api.github.com/users/drbyte/repos","events_url":"https://api.github.com/users/drbyte/events{/privacy}","received_events_url":"https://api.github.com/users/drbyte/received_events","type":"User","site_admin":false},"created_at":"2018-04-12T14:47:53Z","updated_at":"2018-04-12T14:47:53Z","author_association":"NONE","body":"If it doesn't make it into core, you could submit a package here for everyone to use: https://github.com/laravel-validation-rules"}}
{"actor":{"display_login":"drbyte"}}