{"id":964,"date":"2023-09-17T15:51:57","date_gmt":"2023-09-17T06:51:57","guid":{"rendered":"https:\/\/shinke1987.net\/?p=964"},"modified":"2023-09-17T15:51:58","modified_gmt":"2023-09-17T06:51:58","slug":"laravel%e3%81%a7%e3%81%ae%e3%83%95%e3%82%a9%e3%83%bc%e3%83%a0%e3%81%a8%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%8b%95%e4%bd%9c%e7%a2%ba%e8%aa%8d","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=964","title":{"rendered":"Laravel\u3067\u306e\u30d5\u30a9\u30fc\u30e0\u3068\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u52d5\u4f5c\u78ba\u8a8d"},"content":{"rendered":"\n<h2 id=\"toc0\" class=\"wp-block-heading\">app\/Http\/Controllers\/ValidationController.php<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\nnamespace App\\Http\\Controllers;\nuse Illuminate\\Http\\Request;\nclass ValidationController extends Controller\n{\n    \/\/ \u5165\u529b\u753b\u9762\u3092\u8868\u793a\u3002\n    public function show(Request $request) {\n        return view(&#039;vtest&#039;);\n    }\n\t\/\/ \u30a2\u30af\u30b7\u30e7\u30f3\u3002\n    public function post(Request $request) {\n        $validated = $request -&gt; validate(&#x5B;\n            &#039;txtMailAddress&#039; =&gt; &#039;required | email:filter&#039;,\n            &#039;emailMailAddress&#039; =&gt; &#039;required | email&#039;,\n        ]);\n        return view(&#039;vtestResult&#039;)\n            -&gt;with(&#039;txtMailAddress&#039;, $validated&#x5B;&#039;txtMailAddress&#039;])\n            -&gt;with(&#039;emailMailAddress&#039;, $validated&#x5B;&#039;emailMailAddress&#039;]);\n    }\n}\n<\/pre><\/div>\n\n\n<h2 id=\"toc1\" class=\"wp-block-heading\">resources\/views\/vtest.blade.php<\/h2>\n\n\n\n<p>old\u30d8\u30eb\u30d1\u95a2\u6570\u3067\u524d\u56de\u306e\u5165\u529b\u5024\u3092\u53d6\u5f97\u3067\u304d\u308b\u3002<br>$errors->get(&#8216;name\u306e\u5024&#8217;)\u3067\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3067\u304d\u308b\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;html&gt;\n    &lt;head&gt;\n        &lt;title&gt;vtest&lt;\/title&gt;\n    &lt;\/head&gt;\n    &lt;body&gt;\n    &lt;form method=&quot;post&quot; action=&quot;{{route(&#039;vpost&#039;)}}&quot;&gt;\n        @csrf\n        \u30bf\u30a4\u30d7\uff1atext&amp;nbsp;:&amp;nbsp;&lt;input type=&quot;text&quot; name=&quot;txtMailAddress&quot;&gt;&lt;br&gt;\n        \u30bf\u30a4\u30d7\uff1aemail&amp;nbsp;:&amp;nbsp;&lt;input type=&quot;email&quot; name=&quot;emailMailAddress&quot;&gt;&lt;br&gt;\n        &lt;input type=&quot;submit&quot; value=&quot;\u9001\u4fe1&quot;&gt;\n    &lt;\/form&gt;\n    &lt;hr&gt;\n    \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc\u306e\u7d50\u679c&lt;br&gt;\n    text&amp;nbsp;:&amp;nbsp;{{var_dump($errors -&gt; get(&#039;txtMailAddress&#039;))}}&lt;br&gt;\n    email&amp;nbsp;:&amp;nbsp;{{var_dump($errors -&gt; get(&#039;emailMailAddress&#039;))}}&lt;br&gt;\n    old\u30d8\u30eb\u30d1\u95a2\u6570(txtMailAddress)\uff1a{{old(&#039;txtMailAddress&#039;)}}&lt;br&gt;\n    old\u30d8\u30eb\u30d1\u95a2\u6570(emailMailAddress)\uff1a{{old(&#039;emailMailAddress&#039;)}}&lt;br&gt;\n    &lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre><\/div>\n\n\n<h2 id=\"toc2\" class=\"wp-block-heading\">resources\/views\/vtestResult.blade.php<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;html&gt;\n    &lt;head&gt;\n        &lt;title&gt;vtestResult&lt;\/title&gt;\n    &lt;\/head&gt;\n    &lt;body&gt;\n        \u7d50\u679c&lt;br&gt;\n        text&amp;nbsp;:&amp;nbsp;{{$txtMailAddress}}&lt;br&gt;\n        emai&amp;nbsp;:&amp;nbsp;{{$emailMailAddress}}&lt;br&gt;\n    &lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre><\/div>\n\n\n<h2 id=\"toc3\" class=\"wp-block-heading\">routes\/web.php<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\nuse App\\Http\\Controllers\\ValidationController;\n\n\/\/ \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30c6\u30b9\u30c8\u7528\u30d5\u30a9\u30fc\u30e0\u8868\u793a\u3002\nRoute::get(&#039;\/vtest&#039;, &#x5B;ValidationController::class, &#039;show&#039;]) -&gt; name(&#039;vtest&#039;);\n\/\/ \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30c6\u30b9\u30c8\u7528\u30d5\u30a9\u30fc\u30e0\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3002\n Route::post(&#039;\/vtest&#039;, &#x5B;ValidationController::class, &#039;post&#039;]) -&gt; name(&#039;vpost&#039;);\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>app\/Http\/Controllers\/ValidationController.php resources\/views\/vtest.blade.php old\u30d8\u30eb\u30d1\u95a2\u6570\u3067\u524d\u56de\u306e\u5165\u529b\u5024\u3092\u53d6\u5f97\u3067\u304d\u308b\u3002$errors->g [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[96],"tags":[88,81],"class_list":["post-964","post","type-post","status-publish","format-standard","hentry","category-laravel","tag-laravel","tag-php"],"_links":{"self":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=964"}],"version-history":[{"count":1,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/964\/revisions"}],"predecessor-version":[{"id":965,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/964\/revisions\/965"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}