{"id":2958,"date":"2026-07-28T19:09:12","date_gmt":"2026-07-28T10:09:12","guid":{"rendered":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/?page_id=2958"},"modified":"2026-09-03T13:15:41","modified_gmt":"2026-09-03T04:15:41","slug":"laravel-04","status":"publish","type":"page","link":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/programming\/php\/laravel-04","title":{"rendered":"\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306e\u69cb\u7bc9"},"content":{"rendered":"<details>\n  <summary>\n    \u524d\u56de\u7d42\u4e86\u6642\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\n  <\/summary>\n  <p>Laravel\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n<div class='console'><pre>\n$ git clone https:\/\/kiku3.tsbio.info\/git\/study-laravel.git study_laravel\n<\/pre><\/div>\n\n<p>\u3053\u306e\u7ae0\u958b\u59cb\u6642\u70b9\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f chapt4 \u30d6\u30e9\u30f3\u30c1\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n<div class='console'><pre>\n$ git switch chapt4\n<\/pre><\/div>\n\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u81ea\u5206\u3067\u66f8\u3044\u3066\u3044\u304f\u5834\u5408\u306f\u3001\u81ea\u5206\u7528\u306e\u30d6\u30e9\u30f3\u30c1\u3092\u3064\u304f\u308b\u3068\u3088\u3044\u3067\u3059\u3002<\/p>\n<div class='console'><pre>\n$ git switch -c my4 chapt4\n<\/pre><\/div>\n\n<p>Laravel\u306e\u30b3\u30fc\u30c9\u306fsrc\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089\u306e\u76f8\u5bfe\u30d1\u30b9\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/details>\n\n\n<h2>Laravel\u3067\u306eCSS\u306e\u66f8\u304d\u65b9<\/h2>\n<p><code>public<\/code>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u30d6\u30e9\u30a6\u30b6\u30fc\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u306e\u3067\u3001\u3053\u3053\u306bstyle.css\u3092\u304a\u3051\u3070\u3001HTML\u306ehead\u30bf\u30b0\u5185\u3067 <code>&lt;link rel=&quot;stylesheet&quot; href=&quot;\/style.css&quot; \/&gt;<\/code> \u3068\u3057\u3066\u3001\u30b9\u30bf\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3057\u304b\u3057\u3053\u306e\u65b9\u6cd5\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u554f\u984c\u304c\u751f\u3058\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u30d9\u30fc\u30b9URL\u304c\u5909\u66f4\u306b\u306a\u3063\u305f\u3068\u304d(\u7279\u306b\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u52d5\u304b\u3059\u5834\u5408)\u3001href\u3092\u66f8\u304d\u63db\u3048\u308b\u5fc5\u8981\u304c\u751f\u3058\u308b\u3002<\/li>\n<li>CSS\u304c\u30d6\u30e9\u30a6\u30b6\u30fc\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u3066\u3001\u5909\u66f4\u304c\u53cd\u6620\u3055\u308c\u306a\u3044\u3053\u3068\u304c\u3042\u308b\u3002<\/li>\n<\/ol>\n<p>Laravel\u306fvite\u3068\u9023\u643a\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u3046\u3057\u305f\u554f\u984c\u3092\u907f\u3051\u3064\u3064\u3001\u3055\u3089\u306b\u4fbf\u5229\u306a\u6a5f\u80fd\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><\/p>\n<h3><code>resources\/css\/app.css<\/code> \u3092\u7de8\u96c6\u3059\u308b<\/h3>\n<p>Laravel\u3067\u306fCSS\u306f <code>resources\/css<\/code> \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u7f6e\u304d\u307e\u3059\u3002\n\u57fa\u672c\u7684\u306b <code>app.css<\/code> \u306b\u66f8\u3044\u3066\u3001\u3055\u3089\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u5206\u5272\u3057\u305f\u3044\u3068\u304d\u306f <code>app.css<\/code> \u304b\u3089 <code>@import<\/code> \u3067\u8aad\u307f\u8fbc\u3080\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/css\/app.css<\/h5>\n<pre >\n@import &#039;tailwindcss&#039;;\n \n@source &#039;..\/..\/vendor\/laravel\/framework\/src\/Illuminate\/Pagination\/resources\/views\/*.blade.php&#039;;\n@source &#039;..\/..\/storage\/framework\/views\/*.php&#039;;\n \n@theme {\n    --font-sans: &#039;Instrument Sans&#039;, ui-sans-serif, system-ui, sans-serif, &#039;Apple Color Emoji&#039;, &#039;Segoe UI Emoji&#039;,\n        &#039;Segoe UI Symbol&#039;, &#039;Noto Color Emoji&#039;;\n}\n \n\/* \u4ee5\u4e0b\u3092\u8ffd\u52a0\u3057\u3066CSS\u306e\u52b9\u679c\u3092\u78ba\u304b\u3081\u308b *\/\nheader {\n    background-color: #3B82F6;\n    color: white;\n}\n<\/pre>\n<\/div>\n<p>css\u3092\u8aad\u307f\u8fbc\u3080\u3088\u3046\u306b\u3001HTML\u306ehead\u30bf\u30b0\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002\n<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/layouts\/html.blade.php<\/h5>\n<pre >\n&lt;!DOCTYPE html&gt;\n&lt;html lang=&quot;{{ config(&#039;app.locale&#039;) }}&quot;&gt;\n  &lt;head&gt;\n    &lt;meta charset=&quot;utf-8&quot;&gt;\n    &lt;title&gt;{{ config(&#039;app.name&#039;) }}&lt;\/title&gt;\n    {{-- vite\u306b\u3088\u3063\u3066\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u793a\u3059link\u3068\u304bscript\u30bf\u30b0\u306b\u7f6e\u304d\u63db\u3048\u308b --}}\n    @vite([&#039;resources\/css\/app.css&#039;, &#039;resources\/js\/app.js&#039;])  \n  &lt;\/head&gt;\n  &lt;body&gt;\n    @yield(&#039;body&#039;)\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre>\n<\/div>\n<p>\u3053\u306e@vite\u306fBlade\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3067\u3059\u3002<\/p>\n<p>app.css\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u307e\u3059\u3002<\/p>\n<div class='console'><pre>\n$ npm run build\n<\/pre><\/div>\n<p>\u30d6\u30e9\u30a6\u30b6\u30fc\u3067\u518d\u8aad\u307f\u8fbc\u307f\u3092\u3059\u308b\u3068\u53cd\u6620\u3055\u308c\u307e\u3059\u3002<\/p>\n<p class='info' style='border: 1px dashed gray; padding: 0.2em;'><small>\u5f8c\u8ff0\u3059\u308btailwindcss\u304c\u3059\u3067\u306b\u306f\u3044\u3063\u3066\u3044\u3066\u3001\u4e0a\u8a18\u306e\u4fee\u6b63\u306b\u3088\u308a\u305d\u308c\u304c\u6709\u52b9\u306b\u306a\u308b\u3002\u305d\u306e\u7d50\u679cheader\u4ee5\u5916\u306e\u3068\u3053\u308d\u3082\u898b\u305f\u76ee\u304c\u5909\u308f\u308b\u3002<\/small><\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u30fc\u3067\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u307f\u308b\u3068\u3001@vite\u306e\u90e8\u5206\u304c\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u3089\u308c\u3066\u3044\u308b\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <pre >\n&lt;link rel=&quot;preload&quot; as=&quot;style&quot; href=&quot;http:\/\/xxx\/build\/assets\/app-PDEzYLFL.css&quot; \/&gt;\n<\/pre>\n<\/div>\n<p><code>npm run build<\/code>\u3067\u3064\u304f\u3089\u308c\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u6bce\u56de\u540d\u524d\u304c\u5909\u308f\u308b\u306e\u3067\u3001\u305d\u308c\u306b\u5408\u308f\u305b\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u3092href\u3068\u3057\u3066\u66f8\u304d\u51fa\u3057\u3066\u3044\u308b\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<div class='info' style='border: 1px dashed gray; padding: 0.2em;'>\n<p><small>npm run build\u3067\u884c\u308f\u308c\u308b\u3053\u3068\u306f <code>package.json<\/code> \u306b\u304b\u304b\u308c\u3066\u3044\u308b\u3002vite build\u304c\u5b9f\u884c\u3055\u308c\u3001 <code>public\/build\/manifest.json<\/code> \u304c\u3064\u304f\u3089\u308c\u3001@vite\u306e\u3068\u3053\u308d\u3067\u3053\u306e\u4e2d\u306b\u3042\u308b\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u7f6e\u304d\u63db\u3048\u3089\u308c\u308b\u3002\n<\/small><\/p>\n<p><small><code>vite.config.js<\/code>\u306bapp.css\u3068app.js\u3092\u51e6\u7406\u3059\u308b\u3088\u3046\u306b\u66f8\u304b\u308c\u3066\u3044\u308b\u3002\napp.css\u3067@import\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001vite.config.js\u306bcss\u3068\u304bjavascript\u3068\u304b\u3092\u8ffd\u52a0\u3057\u3066\u3082\u3088\u3044\u3002\n<\/small><\/p>\n<\/div>\n<h3>HMR (Hot Module Replacement)\u3092\u4f7f\u3046<\/h3>\n<p>CSS\u3092\u66f8\u304d\u63db\u3048\u308b\u305f\u3073\u306b <code>npm run build<\/code> \u3068\u3059\u308b\u306e\u306f\u3068\u3066\u3082\u9762\u5012\u3067\u3059\u3002\nvite\u306eHMR\u3068\u3044\u3046\u6a5f\u80fd\u3092\u4f7f\u3046\u3068\u3001\u30d6\u30e9\u30a6\u30b6\u30fc\u306e\u518d\u8aad\u307f\u8fbc\u307f\u3059\u3089\u5fc5\u8981\u306a\u304f\u3001CSS\u3084\u30d3\u30e5\u30fc\u304c\u53cd\u6620\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\n\u305d\u306e\u305f\u3081\u306b\u3001\u753b\u9762\u8868\u793a\u306b\u95a2\u308f\u308b\u90e8\u5206\u306f <code>resources<\/code>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u307e\u3068\u3081\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305avite\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002\n\u3053\u308c\u306f\u5e38\u99d0\u3059\u308b\u306e\u3067\u3001\u65b0\u3057\u3044\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u958b\u3044\u3066\u304a\u304f\u3068\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre class='console'>\n$ npm run dev\n<\/pre>\n<p>\u3053\u306e\u3068\u304d@vite\u306e\u90e8\u5206\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <pre >\n&lt;script type=&quot;module&quot; src=&quot;http:\/\/127.0.0.1:5173\/@@vite\/client&quot;&gt;&lt;\/script&gt;\n&lt;link rel=&quot;stylesheet&quot; href=&quot;http:\/\/127.0.0.1:5173\/resources\/css\/app.css&quot; \/&gt;\n&lt;script type=&quot;module&quot; src=&quot;http:\/\/127.0.0.1:5173\/resources\/js\/app.js&quot;&gt;&lt;\/script&gt;\n<\/pre>\n<\/div>\n<p>\u3053\u308c\u306fvite\u304c5173\u30dd\u30fc\u30c8\u3067\u5f85\u3061\u53d7\u3051\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\n\u305d\u3057\u3066\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u66f8\u304d\u63db\u3048\u3089\u308c\u308b\u3068\u3001\u30d6\u30e9\u30a6\u30b6\u30fc\u3068\u901a\u4fe1\u3057\u3066\u3001\u753b\u9762\u306e\u66f8\u304d\u63db\u3048\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>app.css\u3092\u4fee\u6b63\u3059\u308b\u3068\u3001\u30d6\u30e9\u30a6\u30b6\u30fc\u3092\u518d\u8aad\u307f\u8fbc\u307f\u3059\u308b\u3053\u3068\u3082\u3001npm run build\u3059\u308b\u3053\u3068\u3082\u306a\u304f\u3001\u753b\u9762\u304c\u5909\u66f4\u3055\u308c\u308b\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<h2>tailwindcss\u3092\u4f7f\u3046<\/h2>\n<p>tailwindcss\u306fCSS\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002<\/p>\n<p>\u901a\u5e38\u3001CSS\u306fHTML\u306e\u30bf\u30b0(\u8981\u7d20)\u3084\u305d\u308c\u306b\u8a2d\u5b9a\u3055\u308c\u305f\u30af\u30e9\u30b9\u306b\u5bfe\u3057\u3066\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u4f7f\u3044\u307e\u3059\u3002\n\u3057\u304b\u3057\u3001\u3053\u3053\u307e\u3067\u3064\u304f\u3063\u3066\u304d\u305f\u3088\u3046\u306b\u3001HTML\u304c\u30ec\u30a4\u30a2\u30a6\u30c8\u3068\u304b\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3068\u3068\u304b\u3067\u7d30\u5207\u308c\u306b\u306a\u3063\u3066\u304f\u308b\u3068\u3001HTML\u306e\u3069\u306e\u8981\u7d20\u306e\u30b9\u30bf\u30a4\u30eb\u304c\u3069\u306eCSS\u306b\u5165\u3063\u3066\u3044\u308b\u306e\u304b\u304c\u308f\u304b\u3089\u306a\u304f\u306a\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>tailwindcss\u3067\u306fHTML\u306e\u8981\u7d20\u306b\u76f4\u63a5\u30b9\u30bf\u30a4\u30eb\u3068\u5bfe\u5fdc\u3059\u308b\u30af\u30e9\u30b9\u3092\u3064\u3051\u3066\u3001CSS\u3092\u6271\u3046\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30af\u30e9\u30b9\u306e\u4e00\u89a7\u306f <a href=\"https:\/\/telehakke.github.io\/tailwindcss-japanese-cheat-sheet\/\">Tailwind CSS \u65e5\u672c\u8a9e\u30c1\u30fc\u30c8\u30b7\u30fc\u30c8<\/a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30bf\u30d6\u3092\u6a2a\u4e26\u3073\u306b\u3057\u3066\u3001\u80cc\u666f\u8272\u3092\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/layouts\/app.blade.php<\/h5>\n<pre >\n@extends(&#039;layouts.html&#039;)\n \n@section(&#039;body&#039;)\n  &lt;header class=&#039;bg-blue-500 text-white py-2 px-2 flex justify-between items-start&#039;&gt;  {{-- \u80cc\u666f\u8272\u3001\u6587\u5b57\u8272\u3001\u4f59\u767d(padding) --}}\n    &lt;h1 class=&#039;text-xl leading-none&#039;&gt;{{ config(&#039;app.name&#039;) }}&lt;\/h1&gt;\n  &lt;\/header&gt;\n  &lt;main id=&#039;modules&#039; class=&#039;bg-yellow-100 px-2 min-h-screen&#039;&gt;\n    &lt;nav class=&#039;bg-yellow-100 py-2 px-2&#039;&gt;\n      &lt;ul id=&#039;module-tabs&#039; class=&#039;flex&#039;&gt;  {{-- \u30bf\u30d6\u304c\u6a2a\u4e26\u3073\u306b\u306a\u308b\u3088\u3046\u306bflex\u3092\u8ffd\u52a0 --}}\n        &lt;li class=&#039;module-tab&#039;&gt;&lt;a id=&#039;oligo-tab&#039; href=&#039;\/oligo&#039;&gt;\u30aa\u30ea\u30b4DNA&lt;\/a&gt;&lt;\/li&gt;\n        {{-- \u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u8907\u6570\u4e26\u3093\u3060\u3068\u304d\u306e\u69d8\u5b50\u304c\u308f\u304b\u308b\u3088\u3046\u306b\u30c0\u30df\u30fc\u3092\u8ffd\u52a0 --}}\n        &lt;li class=&#039;module-tab&#039;&gt;&lt;a id=&#039;dummy1-tab&#039; href=&#039;\/dummy1&#039;&gt;\u30c0\u30df\u30fc1&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li class=&#039;module-tab&#039;&gt;&lt;a id=&#039;dummy2-tab&#039; href=&#039;\/dummy2&#039;&gt;\u30c0\u30df\u30fc2&lt;\/a&gt;&lt;\/li&gt;\n        &lt;li class=&#039;module-tab&#039;&gt;&lt;a id=&#039;dummy3-tab&#039; href=&#039;\/dummy3&#039;&gt;\u30c0\u30df\u30fc3&lt;\/a&gt;&lt;\/li&gt;\n      &lt;\/ul&gt;\n    &lt;\/nav&gt;\n    @yield(&#039;module&#039;)\n  &lt;\/main&gt;\n@endsection\n<\/pre>\n<\/div>\n<h3>\u30af\u30e9\u30b9\u306btailwindcss\u3092\u8a2d\u5b9a\u3059\u308b<\/h3>\n<p>tailwindcss\u306e\u30af\u30e9\u30b9\u306fCSS\u306e\u30b9\u30bf\u30a4\u30eb\u306e\u4ee3\u308f\u308a\u306b\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\nCSS\u306e<code>\u30d7\u30ed\u30d1\u30c6\u30a3: \u5024;<\/code>\u306e\u4ee3\u308f\u308a\u306b\u3001<code>@apply<\/code> \u306b\u7d9a\u3044\u3066\u3001tailwindcss\u306e\u30af\u30e9\u30b9\u3092\u4e26\u3079\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/css\/app.css<\/h5>\n<pre >\n@import &#039;tailwindcss&#039;;\n \n@source &#039;..\/..\/vendor\/laravel\/framework\/src\/Illuminate\/Pagination\/resources\/views\/*.blade.php&#039;;\n@source &#039;..\/..\/storage\/framework\/views\/*.php&#039;;\n \n@theme {\n    --font-sans: &#039;Instrument Sans&#039;, ui-sans-serif, system-ui, sans-serif, &#039;Apple Color Emoji&#039;, &#039;Segoe UI Emoji&#039;,\n        &#039;Segoe UI Symbol&#039;, &#039;Noto Color Emoji&#039;;\n}\n \n.module-tab {\n    @apply\n        border border-black \/* \u67a0\u7dda\u306e\u8a2d\u5b9a *\/\n        first:rounded-l  \/* first: \u306b\u3088\u3063\u3066\u3001\u6700\u521d\u306e\u8981\u7d20\u306b\u9650\u5b9a\u3059\u308b\u3002\u5de6\u5074(-l)\u306e\u307f\u4e38\u3081\u308b(rounded)\u3002 *\/\n        last:rounded-r  \/* \u540c\u69d8\u306b\u6700\u5f8c\u306e\u67a0\u7dda\u306e\u53f3\u5074(-r)\u3092\u4e38\u3081\u308b\u3002 *\/\n        font-sans font-bold \n        px-6 bg-white  \/* \u6587\u5b57\u306e\u5de6\u53f3\u306e\u4f59\u767d(padding x)\u30926px\u3001\u80cc\u666f\u8272\u3092\u767d\u306b\u8a2d\u5b9a *\/\n        hover:bg-blue-500 hover:text-white \/* \u30db\u30d0\u30fc\u6642\u306e\u80cc\u666f\u8272\u3092\u9752\u3001\u6587\u5b57\u8272\u3092\u767d\u306b\u8a2d\u5b9a *\/\n    ;\n}\n \n.feature-tabs {\n    @apply flex;\n}\n.feature-tab {\n    @apply border-t border-x border-black rounded-t-md mx-1 px-6 font-sans font-bold bg-gray-400 hover:bg-white hover:text-black;\n}\n \n.features {\n    @apply bg-white p-2 min-h-screen;\n}\n<\/pre>\n<\/div>\n<h2>Javascript\u3067\u30bf\u30d6\u5207\u308a\u66ff\u3048<\/h2>\n<p>\u3053\u308c\u307e\u3067\u3064\u304f\u3063\u305f\u30da\u30fc\u30b8\u3067\u306f\u307f\u304b\u3051\u306f\u30bf\u30d6\u306b\u306a\u3063\u3066\u3044\u308b\u304c\u3001\u305d\u308c\u305e\u308c\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30da\u30fc\u30b8\u306e\u66f4\u65b0\u304c\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n\u30da\u30fc\u30b8\u304c\u66f4\u65b0\u3055\u308c\u308b\u3068\u5165\u529b\u9014\u4e2d\u306e\u3082\u306e\u304c\u6d88\u3048\u305f\u308a\u3001\u691c\u7d22\u7d50\u679c\u304c\u4fdd\u5b58\u3055\u308c\u306a\u3044\u306a\u3069\u3001\u4f7f\u3044\u52dd\u624b\u304c\u60aa\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u30bf\u30d6\u306e\u5207\u308a\u66ff\u3048\u3092\u3001\u30d1\u30cd\u30eb\u306e\u8868\u793a\u30fb\u975e\u8868\u793a\u3067\u884c\u3046\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\n\u305d\u306e\u305f\u3081\u306b Alipine.js \u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\nAlpine.js\u306fJavascript\u306e\u5909\u6570(\u5b9f\u969b\u306b\u306fProxy\u30aa\u30d6\u30b8\u30a7\u30af\u30c8)\u306e\u5024\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u304d\u3001HTML\u3092\u5909\u66f4\u3059\u308b\u3068\u3044\u3046\u3053\u3068\u3092\u5bb9\u6613\u306b\u3057\u307e\u3059\u3002\n\u3053\u3053\u3067\u306f\u3001\u30d1\u30cd\u30eb\u306e\u8868\u793a\u30fb\u975e\u8868\u793a\u3092activeFeature\u3068\u3044\u3046\u5909\u6570\u306e\u72b6\u614b\u3068\u9023\u52d5\u3055\u305b\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h4>Alpine.js\u306e\u30b5\u30a4\u30c8<\/h4>\n<ul>\n<li><a href=\"https:\/\/alpinejs.dev\/\">Alpine.js<\/a><\/li>\n<\/ul>\n<h3>Alpine.js\u3068htmx\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>\u3053\u306e\u5f8c\u4f7f\u3046htmx\u3068\u3044\u3063\u3057\u3087\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<div class='console'><pre>\n$ npm install alpinejs htmx.org\n<\/pre><\/div>\n<p>app.js\u3067\u3053\u308c\u3089\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u3001\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/js\/app.js<\/h5>\n<pre >\n\/\/ htmx \u306e\u8aad\u307f\u8fbc\u307f\u3068\u30b0\u30ed\u30fc\u30d0\u30eb\u767b\u9332\nimport htmx from &#039;htmx.org&#039;;\nwindow.htmx = htmx;\n \n\/\/ Alpine.js \u306e\u8aad\u307f\u8fbc\u307f\u3068\u521d\u671f\u5316\nimport Alpine from &#039;alpinejs&#039;;\nwindow.Alpine = Alpine;\n \nAlpine.start();\n<\/pre>\n<\/div>\n<h3>Alpine.js \u3092\u4f7f\u3063\u3066\u8868\u793a\u30fb\u975e\u8868\u793a\u3092\u5207\u308a\u66ff\u3048\u308b<\/h3>\n<p>Alpine.js \u3067\u306fHTML\u306e\u8981\u7d20\u306bx-data\u3068\u3044\u3046\u5c5e\u6027\u3092\u8a2d\u5b9a\u3057\u3001\u305d\u306e\u8981\u7d20\u306e\u5185\u5074\u3067\u4f7f\u7528\u3059\u308b\u5909\u6570\u306a\u3069\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<pre class='code'>\n&lt;div x-data=&quot;{activeFeature: &#039;&#039;}&quot; &gt;\n<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u306ediv\u8981\u7d20\u306e\u5b50\u8981\u7d20\u3067activeFeature\u3068\u3044\u3046\u5909\u6570\u3092\u53c2\u7167\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>module\u30ec\u30d9\u30eb\u306ediv\u8981\u7d20\u306bx-data\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/components\/module.blade.php<\/h5>\n<pre >\n&lt;div {{ $attributes-&gt;merge([&#039;class&#039; =&gt; &#039;module-panel&#039;]) }} role=&quot;tabpanel&quot;\n  x-data=&quot;{ activeFeature: &#039;&#039; }&quot;  {{-- Alpine.js\u306e\u5909\u6570\u3068\u3057\u3066activeFeature\u3092\u5b9a\u7fa9 --}}\n&gt;\n  {{ $slot }}\n&lt;\/div&gt;\n<\/pre>\n<\/div>\n<p>a\u30bf\u30b0\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3068\u304d\u306b\u3001activeFeature\u306b\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\n<code>@click=&quot;&quot;<\/code> \u306fAlpine.js\u306e\u30a4\u30d9\u30f3\u30c8\u306e\u66f8\u304d\u65b9\u3067\u3001\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3068\u304d\u306bactiveFeature\u306b\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\n.prevent\u3092\u3064\u3051\u308b\u3053\u3068\u3067\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u52d5\u4f5c(a\u30bf\u30b0\u306e\u5834\u5408\u306fhref\u3092\u958b\u304f)\u3092\u30ad\u30e3\u30f3\u30bb\u30eb\u3057\u307e\u3059\u3002\n<a href=\"https:\/\/alpinejs.dev\/directives\/on\">Alpine.js x-on<\/a><\/p>\n<p><code>:class=&quot;{}&quot;<\/code>\u306fAlpine.js\u306b\u3088\u308b\u5c5e\u6027\u5024\u3092\u5909\u66f4\u3059\u308b\u66f8\u304d\u65b9\u3067\u3059\u3002Javascript\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5024\u304c\u771f\u306e\u3068\u304d\u3001\u30ad\u30fc(\u3053\u306e\u5834\u5408bg-white\u3068\u304bbg-gray-400\u3068\u304b)\u304c\u30af\u30e9\u30b9\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>activeFeature\u306e\u5024\u304c\u5909\u66f4\u306b\u306a\u3063\u305f\u306e\u304b\u3092\u308f\u304b\u308a\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u3001li\u3092\u8ffd\u52a0\u3057\u3066\u3001\u305d\u308c\u306bx-text\u5c5e\u6027\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002\nx-text\u306f\u8a2d\u5b9a\u3055\u308c\u305fJavascript\u306e\u5f0f\u3092\u8a55\u4fa1\u3057\u3066\u3001\u8981\u7d20\u306e\u30c6\u30ad\u30b9\u30c8\u306b\u7f6e\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/oligo\/module.blade.php<\/h5>\n<pre >\n@extends(&#039;layouts.app&#039;)\n \n@section(&#039;module&#039;)\n  &lt;x-module id=&#039;oligo&#039;&gt;\n    &lt;!-- \u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30e1\u30cb\u30e5\u30fc --&gt;\n    &lt;nav&gt;\n      &lt;ul class=&#039;feature-tabs&#039; role=&#039;tablist&#039;&gt;\n        @foreach([\n          &#039;index&#039; =&gt; &#039;\u4e00\u89a7&#039;,\n          &#039;create&#039; =&gt; &#039;\u8ffd\u52a0&#039;,\n        ] as $page =&gt; $label)\n          &lt;li class=&#039;feature-tab&#039;\n            {{-- activeFeature\u306e\u5024\u306b\u5fdc\u3058\u3066\u80cc\u666f\u8272\u3092\u5207\u308a\u66ff\u3048\u308b --}}\n            :class=&quot;{\n              &#039;bg-white&#039;: activeFeature === &#039;oligo-{{ $page }}&#039;, \n              &#039;bg-gray-400 hover:bg-gray-200&#039;: activeFeature !== &#039;oligo-{{ $page }}&#039;\n            }&quot;\n          &gt;\n            &lt;a href=&#039;{{ route(&quot;web.oligo.{$page}&quot;) }}&#039; id=&#039;oligo-{{ $page }}-tab&#039; role=&#039;tab&#039;\n              @click.prevent=&quot;activeFeature = &#039;oligo-{{ $page }}&#039;&quot; {{-- activeFeature\u306b\u5024\u3092\u8a2d\u5b9a --}}\n            &gt;\n              {{ $label }}\n            &lt;\/a&gt;\n          &lt;\/li&gt;\n        @endforeach\n        &lt;li class=&#039;feature-tab bg-gray-400&#039; x-text=&quot;activeFeature&quot;&gt; {{-- activeFeature\u306e\u5024\u3092\u8868\u793a --}}\n        &lt;\/li&gt;\n      &lt;\/ul&gt;\n    &lt;\/nav&gt;\n    \n    &lt;!-- feature\u304c\u4e26\u3076\u3068\u3053\u308d --&gt;\n    &lt;div class=&#039;features&#039;&gt;\n      @yield(&#039;feature&#039;)\n    &lt;\/div&gt;\n  &lt;\/x-module&gt;\n@endsection\n<\/pre>\n<\/div>\n<p>feature\u30ec\u30d9\u30eb\u306ediv\u8981\u7d20\u306bx-show\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\nx-show\u306f\u8a2d\u5b9a\u3055\u308c\u305fJavascript\u306e\u5f0f\u304ctrue\u3092\u8fd4\u3059\u3068\u304d\u3001\u305d\u306e\u8981\u7d20\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u3001false\u306e\u3068\u304d\u306b\u975e\u8868\u793a\u306b\u306a\u308a\u307e\u3059\u3002\n\u3053\u306e $id \u306fcomponents\/feature.blade.php\u3092 &lt;x-code id=&quot;xxx&quot;\u3068\u3057\u3066\u547c\u3073\u51fa\u3057\u305f\u3068\u304d\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/components\/feature.blade.php<\/h5>\n<pre >\n@props([&#039;id&#039;])\n&lt;div id=&quot;{{ $id }}&quot; role=&quot;tabpanel&quot;\n  {{ $attributes-&gt;merge([&#039;class&#039; =&gt; &#039;feature-panel&#039;]) }}\n  x-show=&quot;activeFeature === &#039;{{ $id }}&#039;&quot;  {{-- activeFeature\u304c\u3053\u306efeature\u306eid\u3068\u4e00\u81f4\u3059\u308b\u5834\u5408\u306e\u307f\u8868\u793a --}}\n&gt;\n  {{ $slot }}\n&lt;\/div&gt;\n<\/pre>\n<\/div>\n<p>app.css\u3082\u5c11\u3057\u4fee\u6b63\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/css\/app.css<\/h5>\n<pre >\n@import &#039;tailwindcss&#039;;\n \n@source &#039;..\/..\/vendor\/laravel\/framework\/src\/Illuminate\/Pagination\/resources\/views\/*.blade.php&#039;;\n@source &#039;..\/..\/storage\/framework\/views\/*.php&#039;;\n \n@theme {\n    --font-sans: &#039;Instrument Sans&#039;, ui-sans-serif, system-ui, sans-serif, &#039;Apple Color Emoji&#039;, &#039;Segoe UI Emoji&#039;,\n        &#039;Segoe UI Symbol&#039;, &#039;Noto Color Emoji&#039;;\n}\n \n.module-tab {\n    @apply\n        border border-black \/* \u67a0\u7dda\u306e\u8a2d\u5b9a *\/\n        first:rounded-l  \/* first: \u306b\u3088\u3063\u3066\u3001\u6700\u521d\u306e\u8981\u7d20\u306b\u9650\u5b9a\u3059\u308b\u3002\u5de6\u5074(-l)\u306e\u307f\u4e38\u3081\u308b(rounded)\u3002 *\/\n        last:rounded-r  \/* \u540c\u69d8\u306b\u6700\u5f8c\u306e\u67a0\u7dda\u306e\u53f3\u5074(-r)\u3092\u4e38\u3081\u308b\u3002 *\/\n        font-sans font-bold \n        px-6 bg-white  \/* \u6587\u5b57\u306e\u5de6\u53f3\u306e\u4f59\u767d(padding x)\u30926px\u3001\u80cc\u666f\u8272\u3092\u767d\u306b\u8a2d\u5b9a *\/\n        hover:bg-blue-500 hover:text-white \/* \u30db\u30d0\u30fc\u6642\u306e\u80cc\u666f\u8272\u3092\u9752\u3001\u6587\u5b57\u8272\u3092\u767d\u306b\u8a2d\u5b9a *\/\n    ;\n}\n \n.feature-tabs {\n    @apply flex;\n}\n.feature-tab {\n    @apply border-t border-x border-black rounded-t-md mx-1 px-6 font-sans font-bold;\n}\n \n.features {\n    @apply bg-white p-2 min-h-screen;\n}\n<\/pre>\n<\/div>\n<p>\u3053\u308c\u3067\u30bf\u30d6\u306e\u30af\u30ea\u30c3\u30af\u306b\u3088\u308a\u3001feature\u306e\u30d1\u30cd\u30eb\u90e8\u5206\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>htmx\u3092\u4f7f\u3063\u305fHTML\u306e\u5165\u308c\u66ff\u3048<\/h3>\n<p>\u73fe\u5728\u306e\u3068\u3053\u308d\u3001feature\u306e\u30d1\u30cd\u30eb\u306f\u6700\u521d\u306eHTML\u306b\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u30bf\u30d6\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3082\u4e2d\u8eab\u304c\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002\n\u305d\u308c\u305e\u308c\u306e\u30bf\u30d6\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3068\u304d\u306b\u3001feature\u306eHTML\u3092\u53d6\u5f97\u3057\u3001\u5168\u4f53\u306eHTML\u306b\u8ffd\u52a0\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\n\u305d\u306e\u305f\u3081\u306b htmx \u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<h4>htmx\u306e\u30b5\u30a4\u30c8<\/h4>\n<ul>\n<li><a href=\"https:\/\/htmx.org\/\">HTMX AJAX<\/a><\/li>\n<\/ul>\n<p>\u307e\u305a\u3001\u30bf\u30d6\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3068\u304d\u306b\u3001htmx\u3092\u52d5\u4f5c\u3055\u305b\u308b\u95a2\u6570 selectTab \u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/components\/module.blade.php<\/h5>\n<pre >\n&lt;div role=&quot;tabpanel&quot; {{ $attributes-&gt;merge([&#039;class&#039; =&gt; &#039;module-panel&#039;]) }}\n  x-data=&quot;{\n    activeFeature: &#039;&#039;,\n    \/* activeFeature\u306e\u5024\u3092\u5909\u66f4\u3057\u3001\u305d\u306eHTML\u8981\u7d20\u304c\u306a\u3044\u3068\u304d\u306b\u53d6\u5f97\u3059\u308b *\/\n    selectTab(event){\n      \/* a\u30bf\u30b0\u306ehref\u5c5e\u6027\u304b\u3089feature\u306eid\u3092\u53d6\u5f97\u3059\u308b *\/\n      const a = event.currentTarget;\n      const url = a.href;\n      const page = a.id.slice(0, &#039;-tab&#039;.length * -1);\n \n      \/* activeFeature\u306bid\u3092\u8a2d\u5b9a *\/\n      this.activeFeature = page;\n \n      \/* URL\u3092\u5909\u66f4\u3059\u308b\u3002\u3053\u308c\u306b\u3088\u3063\u3066\u30d6\u30e9\u30a6\u30b6\u30fc\u306e\u30ea\u30ed\u30fc\u30c9\u3092\u3057\u3066\u3082\u3001\u4ee5\u524d\u306e\u30da\u30fc\u30b8\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b *\/\n      history.pushState({}, &#039;&#039;, url);\n \n      \/* id\u3067\u8981\u7d20\u3092\u53d6\u5f97 *\/\n      const panel = document.getElementById(page);\n \n      \/* \u8981\u7d20\u3092\u53d6\u5f97\u3067\u304d\u306a\u304b\u3063\u305f\u3068\u304d\u306bhtmx\u3067\u90e8\u5206HTML\u3092\u53d6\u5f97\u3059\u308b *\/\n      if(null == panel) {\n        htmx.ajax(&#039;GET&#039;, url, {\n          target:&#039;#{{ $id }} div.features&#039;, \/* \u53d6\u5f97\u3057\u305fHTML\u306e\u7f6e\u304d\u63db\u3048\u5834\u6240 *\/\n          swap: &#039;beforeend&#039;  \/* \u4eca\u56de\u306fdiv.features\u306e\u5b50\u8981\u7d20\u3068\u3057\u3066\u8ffd\u52a0\u3059\u308b\u306e\u3067beforeend *\/\n        });\n      }\n    }\n  }&quot;\n&gt;\n  {{ $slot }}\n&lt;\/div&gt;\n<\/pre>\n<\/div>\n<p>\u6b21\u306b\u3001a\u30bf\u30b0\u306e\u52d5\u4f5c\u3092\u5909\u66f4\u3057\u307e\u3059\u3002\nactiveFeature\u306b\u76f4\u63a5\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001selectTab\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/oligo\/module.blade.php<\/h5>\n<pre >\n@extends(&#039;layouts.app&#039;)\n \n@section(&#039;module&#039;)\n  &lt;x-module id=&#039;oligo&#039;&gt;\n    &lt;!-- \u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30e1\u30cb\u30e5\u30fc --&gt;\n    &lt;nav&gt;\n      &lt;ul class=&#039;feature-tabs&#039; role=&#039;tablist&#039;&gt;\n        @foreach([\n          &#039;index&#039; =&gt; &#039;\u4e00\u89a7&#039;,\n          &#039;create&#039; =&gt; &#039;\u8ffd\u52a0&#039;,\n        ] as $page =&gt; $label)\n          &lt;li class=&#039;feature-tab&#039;\n            :class=&quot;{\n              &#039;bg-white&#039;: activeFeature === &#039;oligo-{{ $page }}&#039;,\n              &#039;bg-gray-400 hover:bg-gray-200&#039;: activeFeature !== &#039;oligo-{{ $page }}&#039;\n            }&quot;\n          &gt;\n            &lt;a href=&#039;{{ route(&quot;web.oligo.{$page}&quot;) }}&#039; id=&#039;oligo-{{ $page }}-tab&#039; role=&#039;tab&#039;\n \n              {{-- \u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3068\u304d selectTab\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059 --}}\n              @click.prevent=&quot;selectTab(event)&quot;\n \n            &gt;\n              {{ $label }}\n            &lt;\/a&gt;\n          &lt;\/li&gt;\n        @endforeach\n        &lt;li class=&#039;feature-tab bg-gray-400&#039; x-text=&quot;activeFeature&quot;&gt;\n        &lt;\/li&gt;\n      &lt;\/ul&gt;\n    &lt;\/nav&gt;\n    \n    &lt;!-- feature\u304c\u4e26\u3076\u3068\u3053\u308d --&gt;\n    &lt;div class=&#039;features&#039;&gt;\n      @yield(&#039;feature&#039;)\n    &lt;\/div&gt;\n  &lt;\/x-module&gt;\n@endsection\n<\/pre>\n<\/div>\n<p>\u3053\u3053\u307e\u3067\u306e\u3068\u3053\u308d\u3067\u3001\u6700\u521d\u306b\u7528\u610f\u3057\u3066\u3044\u306a\u3044feature\u3067\u3082HTML\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\n\u3057\u304b\u3057\u3001\u30b5\u30fc\u30d0\u30fc\u304c\u8fd4\u3059\u306e\u304cDOCTYPE\u304b\u3089\u59cb\u307e\u308b\u5b8c\u5168\u306aHTML\u306a\u306e\u3067\u3001\u305d\u306e\u307e\u307e\u65e2\u5b58\u306eHTML\u306b\u5dee\u3057\u8fbc\u3080\u3068\u69cb\u9020\u304c\u58ca\u308c\u307e\u3059\u3002\n\u8a72\u5f53\u3059\u308bfeature\u306e\u90e8\u5206 <code>&lt;div id=&quot;oligo-index&quot; class=&quot;feature-panel&quot; &gt;<\/code> \u3092\u8fd4\u3059\u3088\u3046\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<p>Blade\u306b\u306f\u30d3\u30e5\u30fc\u306e\u4e00\u90e8\u5206\u3092\u53d6\u308a\u51fa\u3059 @fragment \u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u304c\u3042\u308a\u307e\u3059\u3002\nhtmx\u304b\u3089\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u3068\u304d\u3001@fragment\u3092\u6709\u52b9\u306b\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>htmx\u306f\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u30fc\u306bHX-Request\u3092\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\n\u306a\u306e\u3067\u3001\u3053\u308c\u304c\u6709\u308b\u3068\u304d\u306b@fragment\u304c\u6709\u52b9\u306b\u3059\u308b\u3088\u3046\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Http\/Controllers\/OligoController.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Http\\Controllers;\n \nuse App\\Http\\Requests\\OligoRequest;\n \nclass OligoController\n{\n    \/\/ CSV\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\n    public function index(){\n        $csv = storage_path(&#039;app\/private\/oligo.csv&#039;);\n        $fp = fopen($csv, &#039;r&#039;);\n        $items = [];\n        while($row = fgetcsv($fp)){\n            $items[] = array_combine([&#039;name&#039;, &#039;sequence&#039;, &#039;created_at&#039;, &#039;owner&#039;], $row);\n        }\n        fclose($fp);\n\treturn view(&#039;oligo.index&#039;, compact(&#039;items&#039;))\n \n            \/* fragmentIf(): \u7279\u5b9a\u306e\u6761\u4ef6\u306e\u3068\u304d\u306b\u3001\u30d3\u30e5\u30fc\u306e\u4e00\u90e8\u3092\u8fd4\u3059\n\t     * 1\u756a\u76ee\u306e\u5f15\u6570\u304c\u6761\u4ef6\u30012\u756a\u76ee\u306e\u5f15\u6570\u304c\u8fd4\u3059\u5185\u5bb9\n\t     *\/\n            -&gt;fragmentIf(request()-&gt;hasHeader(&#039;HX-Request&#039;), &quot;feature-oligo-index&quot;)\n        ;\n    }\n \n    public function create(){\n        return view(&#039;oligo.create&#039;)\n\t    -&gt;fragmentIf(request()-&gt;hasHeader(&#039;HX-Request&#039;), &quot;feature-oligo-create&quot;)\n        ;\n    }\n \n    public function store(OligoRequest $request){\n        $validated = $request-&gt;validated();\n        $data = [];\n        foreach([&#039;name&#039;, &#039;sequence&#039;, &#039;created_at&#039;, &#039;owner&#039;] as $key){\n            $data[] = sprintf(&#039;&quot;%s&quot;&#039;, $validated[$key] ?? &#039;&#039;);\n        }\n        $csv = storage_path(&#039;app\/private\/oligo.csv&#039;);\n        file_put_contents($csv, implode(&#039;,&#039;, $data).PHP_EOL, FILE_APPEND);\n \n        return redirect()-&gt;route(&#039;web.oligo.index&#039;)-&gt;with(&#039;status&#039;, &#039;\u4fdd\u5b58\u3057\u307e\u3057\u305f&#039;);\n    }\n}\n<\/pre>\n<\/div>\n<p>feature.blade.php\u306b@fragment\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u52a0\u3048\u3066\u3001\u90e8\u5206HTML\u3068\u3057\u3066\u8fd4\u3059\u7bc4\u56f2\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/components\/feature.blade.php<\/h5>\n<pre >\n@props([&#039;id&#039;])\n@fragment(&quot;feature-{$id}&quot;)  {{-- feature\u306e\u90e8\u5206HTML\u306e\u7bc4\u56f2\u3092\u793a\u3059 --}}\n  &lt;div id=&quot;{{ $id }}&quot; role=&quot;tabpanel&quot;\n    {{ $attributes-&gt;merge([&#039;class&#039; =&gt; &#039;feature-panel&#039;]) }}\n    x-show=&quot;activeFeature === &#039;{{ $id }}&#039;&quot;  {{-- activeFeature\u304c\u3053\u306efeature\u306eid\u3068\u4e00\u81f4\u3059\u308b\u5834\u5408\u306e\u307f\u8868\u793a --}}\n  &gt;\n    {{ $slot }}\n  &lt;\/div&gt;\n@endfragment\n<\/pre>\n<\/div>\n<h3>\u521d\u671f\u753b\u9762\u3067activeFeature\u3092\u8a2d\u5b9a\u3059\u308b<\/h3>\n<p><code>activeFeature<\/code>\u306e\u521d\u671f\u5024\u306f <code>components\/module.blade.php<\/code> \u4e2d\u3067\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\n\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f <code>OligoController<\/code> &#8211; <code>oligo\/index.blade.php<\/code> &#8211; <code>oligo\/module.blade.php<\/code> &#8211; <code>components\/module.blade.php<\/code> \u306e\u9806\u3067\u547c\u3070\u308c\u308b\u306e\u3067\u3001\u6700\u521d\u306b\u3069\u306efeature\u304c\u547c\u3070\u308c\u3066\u305f\u7d50\u679c\u306a\u306e\u304b\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\n\u305d\u306e\u305f\u3081\u3001\u9069\u5207\u306a\u521d\u671f\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u3053\u3067 <code>components\/module.blade.php<\/code> \u306bURL\u3092\u6e21\u3059\u65b9\u6cd5\u3092\u8003\u3048\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002<\/p>\n<ol>\n<li><code>OligoController<\/code> \u304b <code>oligo\/index.blade.php<\/code> \u304b\u3089 <code>feature_id<\/code> \u3068\u3044\u3046\u5909\u6570\u3092\u9806\u306b\u6e21\u3057\u3066\u3044\u304f\u3002<\/li>\n<li>View\u5168\u4f53\u3067\u4f7f\u3048\u308b\u5909\u6570\u3092\u3064\u304f\u308b\u3002<\/li>\n<\/ol>\n<p>1\u306e\u65b9\u6cd5\u3067\u306f\u3001feature\u3092\u8fd4\u3059\u53ef\u80fd\u6027\u304c\u3042\u308b\u3059\u3079\u3066\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u3001view\u306b\u5909\u6570\u3092\u6e21\u3057\u3066\u3044\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n\u3053\u306e\u5834\u5408\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u5897\u3084\u3057\u305f\u308a\u3001\u6a5f\u80fd\u3092\u62e1\u5f35\u3057\u3066\u3044\u304f\u3068\u304d\u306b\u30df\u30b9\u304c\u8d77\u304d\u308b\u53ef\u80fd\u6027\u304c\u9ad8\u304f\u306a\u308a\u307e\u3059\u3002\n\u306a\u306e\u30672\u306e\u65b9\u6cd5\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n<p>View\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306bfeature_id\u3092\u8a2d\u5b9a\u3059\u308b\u30b3\u30fc\u30c9\u3092 <code>app\/Providers\/AppServiceProvider.php<\/code> \u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>request()\u3067\u30ea\u30af\u30a8\u30b9\u30c8\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3057\u3001Route\u3092\u53d6\u5f97\u3057\u3066\u3001\u73fe\u5728\u306e\u30eb\u30fc\u30c8\u540d\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\n\u3053\u308c\u3092.\u3067\u533a\u5207\u3063\u3066\u3001\u5148\u982d\u3092\u524a\u9664\u3057\u3001-\u3067\u3064\u306a\u304e\u306a\u304a\u3057\u3066 feature_id\u3068\u3057\u307e\u3059\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Providers\/AppServiceProvider.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Providers;\n \nuse Illuminate\\Support\\ServiceProvider;\nuse Illuminate\\Support\\Facades\\View;  \/\/ View\u306e\u8a2d\u5b9a\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\n \nclass AppServiceProvider extends ServiceProvider\n{\n    \/**\n     * Register any application services.\n     *\/\n    public function register(): void\n    {\n        \/\/\n    }\n \n    \/**\n     * Bootstrap any application services.\n     *\/\n    public function boot(): void\n    {\n        View::composer(&#039;*&#039;, function ($view) {\n            $route = request()-&gt;route();\n            if(! is_null($route)){\n                $route_name = $route-&gt;getName();\n                if(! is_null($route_name)){\n                    $feature_id = join(&#039;-&#039;, array_slice(explode(&#039;.&#039;, $route_name), 1));\n                    View::share(&#039;feature_id&#039;, $feature_id);\n                }\n            }\n        });\n    }\n}\n<\/pre>\n<\/div>\n<p>\u3064\u304f\u3063\u305ffeature_id\u3092activeFeature\u306e\u521d\u671f\u5024\u3068\u3057\u3066\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/components\/module.blade.php<\/h5>\n<pre >\n&lt;div role=&quot;tabpanel&quot; {{ $attributes-&gt;merge([&#039;class&#039; =&gt; &#039;module-panel&#039;]) }}\n  x-data=&quot;{\n    activeFeature: &#039;{{ $feature_id }}&#039;,    {{-- AppServiceProvider\u3067\u8a2d\u5b9a\u3057\u305f\u5024\u3092\u4f7f\u3046 --}}\n \n    \/* activeFeature\u306e\u5024\u3092\u5909\u66f4\u3057\u3001\u305d\u306eHTML\u8981\u7d20\u304c\u306a\u3044\u3068\u304d\u306b\u53d6\u5f97\u3059\u308b *\/\n    selectTab(event){\n      \/* a\u30bf\u30b0\u306ehref\u5c5e\u6027\u304b\u3089feature\u306eid\u3092\u53d6\u5f97\u3059\u308b *\/\n      const a = event.currentTarget;\n      const url = a.href;\n      const page = a.id.slice(0, &#039;-tab&#039;.length * -1);\n \n      \/* activeFeature\u306bid\u3092\u8a2d\u5b9a *\/\n      this.activeFeature = page;\n \n      \/* URL\u3092\u5909\u66f4\u3059\u308b\u3002\u3053\u308c\u306b\u3088\u3063\u3066\u30d6\u30e9\u30a6\u30b6\u30fc\u306e\u30ea\u30ed\u30fc\u30c9\u3092\u3057\u3066\u3082\u3001\u4ee5\u524d\u306e\u30da\u30fc\u30b8\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b *\/\n      history.pushState({}, &#039;&#039;, url);\n \n      \/* id\u3067\u8981\u7d20\u3092\u53d6\u5f97 *\/\n      const panel = document.getElementById(page);\n \n      \/* \u8981\u7d20\u3092\u53d6\u5f97\u3067\u304d\u306a\u304b\u3063\u305f\u3068\u304d\u306bhtmx\u3067\u90e8\u5206HTML\u3092\u53d6\u5f97\u3059\u308b *\/\n      if(null == panel) {\n        htmx.ajax(&#039;GET&#039;, url, {\n          target:&#039;#{{ $id }} div.features&#039;, \/* \u53d6\u5f97\u3057\u305fHTML\u306e\u7f6e\u304d\u63db\u3048\u5834\u6240 *\/\n          swap: &#039;beforeend&#039;  \/* \u4eca\u56de\u306fdiv.features\u306e\u5b50\u8981\u7d20\u3068\u3057\u3066\u8ffd\u52a0\u3059\u308b\u306e\u3067beforeend *\/\n        });\n      }\n    }\n  }&quot;\n&gt;\n  {{ $slot }}\n&lt;\/div&gt;\n<\/pre>\n<\/div>\n\n\n\n<div style='display: flex; justify-content: center; gap: 4rem;\n  background-color: #ffefd5;\n  '\n>\n  <a href='laravel-03'>\u524d\u3078<\/a>\n\n<a href='.\/'>PHP\u306e\u5b66\u7fd2 \u76ee\u6b21<\/a>\n\n  <a href='laravel-05'>\u6b21\u3078<\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\u524d\u56de\u7d42\u4e86\u6642\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9 Laravel\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 $ git clone https:\/\/kiku3.tsbio.info\/git\/st [&hellip;]","protected":false},"author":2,"featured_media":0,"parent":2658,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"page-programming.php","meta":{"footnotes":""},"class_list":["post-2958","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/pages\/2958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/comments?post=2958"}],"version-history":[{"count":41,"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/pages\/2958\/revisions"}],"predecessor-version":[{"id":3294,"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/pages\/2958\/revisions\/3294"}],"up":[{"embeddable":true,"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/pages\/2658"}],"wp:attachment":[{"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/media?parent=2958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}