{"id":371,"date":"2022-08-16T11:47:16","date_gmt":"2022-08-16T02:47:16","guid":{"rendered":"https:\/\/kitayama.jp\/?p=371"},"modified":"2022-08-16T11:47:18","modified_gmt":"2022-08-16T02:47:18","slug":"%e3%82%aa%e3%83%aa%e3%82%b8%e3%83%8a%e3%83%ab%e3%83%90%e3%83%aa%e3%83%87%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e5%ae%9a%e7%be%a9","status":"publish","type":"post","link":"https:\/\/kitayama.jp\/?p=371","title":{"rendered":"\u30aa\u30ea\u30b8\u30ca\u30eb\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u5b9a\u7fa9"},"content":{"rendered":"\n<h2>\u30eb\u30fc\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210<\/h2>\n\n\n\n<p>artisan\u30b3\u30de\u30f3\u30c9\u3092\u7528\u3044\u3066\u30eb\u30fc\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ php artisan make:rule name_kana\n<\/code><\/pre>\n\n\n\n<p>app\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4e0b\u306bRules\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u4f5c\u3089\u308c\u305d\u306e\u4e2d\u306bnama_kana.php\u304c\u4f5c\u3089\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002name_kana.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nnamespace App\\Rules;\n\nuse Illuminate\\Contracts\\Validation\\Rule;\n\nclass name_kana implements Rule\n{\n    \/**\n     * Create a new rule instance.\n     *\n     * @return void\n     *\/\n    public function __construct()\n    {\n        \/\/\n    }\n\n    \/**\n     * Determine if the validation rule passes.\n     *\n     * @param  string  $attribute\n     * @param  mixed  $value\n     * @return bool\n     *\/\n    public function passes($attribute, $value)\n    {\n        \/\/\n    }\n\n    \/**\n     * Get the validation error message.\n     *\n     * @return string\n     *\/\n    public function message()\n    {\n        return 'The validation error message.';\n    }\n}\n<\/code><\/pre>\n\n\n\n<h2><a href=\"https:\/\/qiita.com\/sakashin10291029\/items\/dbcf9bb583ff5573aa5a#%E3%83%AB%E3%83%BC%E3%83%AB%E3%83%A1%E3%83%83%E3%82%BB%E3%83%BC%E3%82%B8%E3%82%92%E5%AE%9A%E7%BE%A9\"><\/a>\u30eb\u30fc\u30eb\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5b9a\u7fa9<\/h2>\n\n\n\n<p>passes\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u30eb\u30fc\u30eb\u3092\u5b9a\u7fa9\u3001message\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002name_kana.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    public function passes($attribute, $value)\n    {\n        if(!preg_match('\/&#91;^\u30a1-\u30f4\u30fc]\/u',$value))\n        {\n            return true;\n        }\n\n        return false;\n    }\n<\/code><\/pre>\n\n\n\n<p>\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3044\u3001\u30ab\u30bf\u30ab\u30ca\u3001\u300c\u30fc\u300d\uff08\u5168\u89d2\u4f38\u3070\u3057\u68d2\uff09\u4ee5\u5916\u306e\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u308b\u3068\u304d\u306ffalse\u3092\u8fd4\u3057\u3001\u305d\u308c\u4ee5\u5916\u306ftrue\u3092\u8fd4\u3059\u3088\u3046\u306b\u3057\u307e\u3059\u3002<br>\u5f15\u6570\u306e<code>$attribute<\/code>\u306b\u306f\u30ad\u30fc\u3001<code>$value<\/code>\u306b\u306f\u5024\u304c\u5165\u308a\u307e\u3059\u3002<br>preg_match()\u3067\u7b2c\u4e00\u5f15\u6570\u306e\u6b63\u898f\u8868\u73fe\u306b\u3001\u7b2c\u4e8c\u5f15\u6570\u306e\u5024\u304c\u30de\u30c3\u30c1\u3057\u305f\u3089true\u3001\u30de\u30c3\u30c1\u3057\u306a\u3051\u308c\u3070false\u3068\u306a\u308a\u307e\u3059\u304c\u3001<br>!\u3067\u5426\u5b9a\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u3088\u308a\u30de\u30c3\u30c1\u3057\u305f\u3089false\u3001\u3057\u306a\u3051\u308c\u3070true\u306b\u306a\u308a\u307e\u3059\u3002<br>\u3064\u307e\u308a\u3067\u30ab\u30bf\u30ab\u30ca\u3068\u300c\u30fc\u300d\u4ee5\u5916\uff08\/[^\u30a1-\u30f4\u30fc\u3000]\/u\uff09\u304c<code>$value<\/code>\u306b\u542b\u307e\u308c\u3066\u3044\u306a\u3051\u308c\u3070true\u3092\u8fd4\u3059\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002name_kana.php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    public function message()\n    {\n        return '\u30ab\u30bf\u30ab\u30ca\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044';\n    }\n<\/code><\/pre>\n\n\n\n<h2>\u4f7f\u3044\u65b9<\/h2>\n\n\n\n<p>&#8216;email&#8217; => new EmailRule(),<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30eb\u30fc\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210 artisan\u30b3\u30de\u30f3\u30c9\u3092\u7528\u3044\u3066\u30eb\u30fc\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 app\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4e0b\u306bRules\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u4f5c\u3089\u308c\u305d\u306e\u4e2d\u306bnama_kana.php\u304c\u4f5c\u3089\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002name_kana.php \u30eb\u30fc\u30eb\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5b9a\u7fa9 passes\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u30eb\u30fc\u30eb\u3092\u5b9a\u7fa9\u3001message\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002name_kana.php \u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3044\u3001\u30ab\u30bf\u30ab\u30ca\u3001\u300c\u30fc\u300d\uff08\u5168\u89d2\u4f38\u3070\u3057\u68d2\uff09\u4ee5\u5916\u306e\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u308b\u3068\u304d\u306ffalse\u3092\u8fd4\u3057\u3001\u305d\u308c\u4ee5\u5916\u306f.. <a href=\"https:\/\/kitayama.jp\/?p=371\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/kitayama.jp\/index.php?rest_route=\/wp\/v2\/posts\/371"}],"collection":[{"href":"https:\/\/kitayama.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kitayama.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kitayama.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kitayama.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=371"}],"version-history":[{"count":2,"href":"https:\/\/kitayama.jp\/index.php?rest_route=\/wp\/v2\/posts\/371\/revisions"}],"predecessor-version":[{"id":373,"href":"https:\/\/kitayama.jp\/index.php?rest_route=\/wp\/v2\/posts\/371\/revisions\/373"}],"wp:attachment":[{"href":"https:\/\/kitayama.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kitayama.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kitayama.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}