{"id":282,"date":"2022-03-29T17:00:19","date_gmt":"2022-03-29T08:00:19","guid":{"rendered":"https:\/\/software.satoshis.jp\/?p=282"},"modified":"2023-04-11T14:14:00","modified_gmt":"2023-04-11T05:14:00","slug":"laravel%e3%81%aeblade%e3%81%ab%e8%a8%ad%e7%bd%ae%e3%81%97%e3%81%9fform%e3%81%a7checkbox%e3%81%abold%e5%80%a4%e3%82%92%e5%8f%8d%e6%98%a0%e3%81%95%e3%81%9b%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/software.satoshis.jp\/?p=282","title":{"rendered":"Laravel\u306eblade\u306b\u8a2d\u7f6e\u3057\u305fform\u3067checkbox\u306bold\u5024\u3092\u53cd\u6620\u3055\u305b\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u3000Laravel \u306e blade \u306b form \u3092\u8a2d\u7f6e\u3059\u308b\u3068\u3088\u304f\u3042\u308b\u3053\u3068\u3067\u3059\u304c\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3067\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u3068\u304d\u306b\u3001\u4ee5\u524d\u306e\u5165\u529b\u72b6\u614b\u3092\u4fdd\u6301\u3057\u305f\u3044\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u3000\u3060\u3044\u305f\u3044\u3001 old(&#8216;name&#8217;) \u3092\u66f8\u3044\u3066\u304a\u3051\u3070\u3044\u3044\u611f\u3058\u306b\u306a\u308b\u3093\u3067\u3059\u304c\u3001checkbox \u306f\u3001\u305d\u3046\u7c21\u5358\u306b\u306f\u3067\u304d\u306a\u304b\u3063\u305f\u3067\u3059\u3002<\/p>\n<p> \u3068\u308a\u3042\u3048\u305a\u3001\u4fdd\u6301\u3059\u308b\u3068\u304b\u3092\u8003\u3048\u305a\u306b\u3001\u9805\u76ee\u540d\u306e\u914d\u5217\u3092 @foreach \u3067\u914d\u7f6e\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n    @foreach($checks as $id =&gt; $c)\r\n    &lt;input id=&quot;check-{{ $id }}&quot; type=&quot;checkbox&quot; name=&quot;check&#x5B;]&quot; value=&quot;{{ $id }}&quot; \/&gt;\r\n    &lt;label for=&quot;check-{{ $id }}&quot;&gt;{{ $c }}&lt;\/label&gt;\r\n    @endforeach\r\n<\/pre>\n<p>\u3000\u4ed6\u306e\u5165\u529b\u9805\u76ee\u3067\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3088\u3046\u306b\u3057\u3066 post \u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3000\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u306a\u304b\u3063\u305f\u3089\u3001\u3053\u306e\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u3082\u623b\u3063\u3066\u304d\u3066\u304f\u308c\u307e\u305b\u3093\u306e\u3067\u3002<\/p>\n<p>\u3000\u3067\u3001old \u304c\u3069\u3046\u306a\u3063\u3066\u3044\u308b\u304b\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n    @foreach($checks as $id =&gt; $c)\r\n    &lt;input id=&quot;check-{{ $id }}&quot; type=&quot;checkbox&quot; name=&quot;check&#x5B;]&quot; value=&quot;{{ $id }}&quot; \/&gt;\r\n    &lt;label for=&quot;check-{{ $id }}&quot;&gt;{{ $c }}&lt;\/label&gt;\r\n    {{ is_array(old('check')) }}\r\n    @endforeach\r\n<\/pre>\n<p>\u3000\u307f\u305f\u3044\u306b\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u3084\u308b\u3068\u3001\u5404label \u306e\u3042\u3068\u306b 1 \u3068\u8868\u793a\u3055\u308c\u308b\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u30001\u3068\u3044\u3046\u3053\u3068\u306f old(&#8216;check&#8217;) \u306f\u3001\u914d\u5217\u3060\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u3000\u3067\u306f\u3001checked \u3092\u3064\u3051\u3066\u3084\u308b input \u8981\u7d20\u306f\u3069\u308c\u304b\u3068\u3044\u3046\u8a71\u3067\u3059\u3002<\/p>\n<p>\u3000\u914d\u5217\u3067\u3042\u308b old(&#8216;check&#8217;) \u5185\u306b\u3001 $id \u304c\u542b\u307e\u308c\u3066\u3044\u308c\u3070\u3001\u305d\u306e\u8981\u7d20\u306f checked \u3092\u3064\u3051\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002<\/p>\n<p>\u3000\u3068\u308a\u3042\u3048\u305a\u3001\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u7533\u3059\u5c11\u3057\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p> old(&#8216;check&#8217;) \u304c\u914d\u5217\u3060\u3063\u305f\u3089\u3001 in_array($id, old(&#8216;check)) \u306e\u5024\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n    @foreach($checks as $id =&gt; $c)\r\n    &lt;input id=&quot;check-{{ $id }}&quot; type=&quot;checkbox&quot; name=&quot;check&#x5B;]&quot; value=&quot;{{ $id }}&quot; \/&gt;\r\n    &lt;label for=&quot;check-{{ $id }}&quot;&gt;{{ $c }}&lt;\/label&gt;\r\n    {{ is_array(old('check')) }}\r\n    @if(is_array(old('check))){{ in_array($id, old('check')) }}@endif\r\n    @endforeach\r\n<\/pre>\n<p>\u3000\u3053\u308c\u3092\u66f8\u3044\u3066\u3001checkbox \u306b\u5bfe\u3057\u3066\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3064\u3064\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3088\u3046\u306b\u3057\u3066 post \u3059\u308b\u3068\u3001\u30c1\u30a7\u30c3\u30af\u3057\u305f\u8981\u7d20\u306e\u5f8c\u308d\u306b 1 \u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u3053\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3059 input \u8981\u7d20\u306b checked \u3092\u8ffd\u52a0\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u306d\u3002<br \/>\nold(&#8216;check&#8217;) \u304c\u914d\u5217\u3067\u3042\u308b\u5834\u5408\u3001\u304b\u3064\u3001old(&#8216;check&#8217;) \u306b checked \u3092\u3064\u3051\u308c\u3070\u3088\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<pre class=\"brush: php; highlight: [3]; title: ; notranslate\" title=\"\">\r\n    @foreach($checks as $id =&gt; $c)\r\n    &lt;input id=&quot;check-{{ $id }}&quot; type=&quot;checkbox&quot; name=&quot;check&#x5B;]&quot; value=&quot;{{ $id }}&quot;\r\n    @if(is_array(old('check)) &amp;&amp; in_array($c, old('check'))) checked @endif \/&gt;\r\n    &lt;label for=&quot;check-{{ $id }}&quot;&gt;{{ $c }}&lt;\/label&gt;\r\n    {{ is_array(old('check')) }}\r\n    @if(is_array(old('check))){{ in_array($c, old('check')) }}@endif\r\n    @endforeach\r\n<\/pre>\n<p>\u3000\u4e0d\u8981\u306a\u30b3\u30fc\u30c9\u3092\u6d88\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; highlight: [3]; title: ; notranslate\" title=\"\">\r\n    @foreach($checks as $id =&gt; $c)\r\n    &lt;input id=&quot;check-{{ $id }}&quot; type=&quot;checkbox&quot; name=&quot;check&#x5B;]&quot; value=&quot;{{ $id }}&quot;\r\n    @if(is_array(old('check)) &amp;&amp; in_array($c, old('check'))) checked @endif \/&gt;\r\n    &lt;label for=&quot;check-{{ $id }}&quot;&gt;{{ $c }}&lt;\/label&gt;\r\n    @endforeach\r\n<\/pre>\n<p>\u3000\u3053\u308c\u3067\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u3068\u304d\u306b\u3001checkbox \u306e\u30c1\u30a7\u30c3\u30af\u72b6\u614b\u3092\u4fdd\u6301\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000Laravel \u306e blade \u306b form \u3092\u8a2d\u7f6e\u3059\u308b\u3068\u3088\u304f\u3042\u308b\u3053\u3068\u3067\u3059\u304c\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3067\u30a8\u30e9\u30fc\u306b\u306a\u3063\u305f\u3068\u304d\u306b\u3001\u4ee5\u524d\u306e\u5165\u529b\u72b6\u614b\u3092\u4fdd\u6301\u3057\u305f\u3044\u308f\u3051\u3067\u3059\u3002 \u3000\u3060\u3044\u305f\u3044\u3001 old(&#8216;name &#8230; <\/p>\n","protected":false},"author":1,"featured_media":63,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[23,109,108,14,110],"class_list":["post-282","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-blade","tag-checkbox","tag-input","tag-laravel","tag-old"],"nelio_content":{"autoShareEndMode":"never","automationSources":{"useCustomSentences":false,"customSentences":[]},"efiAlt":"","efiUrl":"","followers":[1],"highlights":[],"isAutoShareEnabled":true,"networkImageIds":[],"permalinkQueryArgs":[],"series":[],"suggestedReferences":[]},"views":10988,"_links":{"self":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=282"}],"version-history":[{"count":1,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions\/283"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=\/wp\/v2\/media\/63"}],"wp:attachment":[{"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/software.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}