{"id":2961,"date":"2026-07-30T18:04:04","date_gmt":"2026-07-30T09:04:04","guid":{"rendered":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/?page_id=2961"},"modified":"2026-08-24T15:19:31","modified_gmt":"2026-08-24T06:19:31","slug":"laravel-05","status":"publish","type":"page","link":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/programming\/php\/laravel-05","title":{"rendered":"\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u3046"},"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 chapt5 \u30d6\u30e9\u30f3\u30c1\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n<div class='console'><pre>\n$ git switch chapt5\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 my5 chapt5\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>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u3046<\/h2>\n<p>PostgreSQL\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u9023\u643a\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u3057\u307e\u3059\u3002<\/p>\n<h3>PHP\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5165\u308c\u308b<\/h3>\n<p>Docker\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u66f4\u65b0\u3057\u307e\u3059\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">php\/Dockerfile<\/h5>\n<pre >\nFROM php:8.5-fpm\r\n\r\nRUN apt-get update &amp;&amp; apt-get install -y unzip \\\r\n    libpq-dev \\\r\n    libonig-dev \\\r\n    &amp;&amp; docker-php-ext-install pdo pdo_pgsql\r\n\r\nCOPY --from=composer:2 \/usr\/bin\/composer \/usr\/bin\/composer\r\n\r\nWORKDIR \/var\/www\/html\n<\/pre>\n<\/div>\n<div class='console'><pre>\n$ sudo docker compose build\n<\/pre><\/div>\n<h3>docker\u3067PostgreSQL\u3092\u4f7f\u3046<\/h3>\n<p>\u3059\u3067\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u3042\u308b\u306e\u306a\u3089\u6539\u3081\u3066\u3064\u304f\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\n<code>docker-compose.yaml<\/code>\u306bpostgresql\u306e\u8a2d\u5b9a\u3092\u52a0\u3048\u3066\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">docker-compose.yaml<\/h5>\n<pre >\nservices:\n  php:\n    build: .\/php\n    container_name: laravel_php\n    volumes:\n      - .\/src:\/var\/www\/html\n      - vendor:\/var\/www\/html\/vendor\n    environment:\n      - TZ=Asia\/Tokyo\n \n  nginx:\n    image: nginx:1.27-alpine\n    container_name: laravel_nginx\n    ports:\n      - &quot;8002:80&quot;\n    volumes:\n      - .\/src\/public:\/var\/www\/html\/public:ro\n      - .\/nginx\/default.conf:\/etc\/nginx\/conf.d\/default.conf\n \n  db:\n    image: postgres:18.4-bookworm    # \u672c\u7a3f\u57f7\u7b46\u6642\u306e\u6700\u65b0\u7248\u3002\u7279\u6bb5\u3001\u3053\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u306f\u306a\u3044\n    environment:\n      POSTGRES_USER: appuser\n      POSTGRES_PASSWORD: secret\n      POSTGRES_DB: appdb\n    volumes:\n      - db_data:\/var\/lib\/postgresql\n    ports:\n      - &quot;5432:5432&quot;\n \nvolumes:\n  vendor:\n  db_data:\n<\/pre>\n<\/div>\n<div class='console'><pre>\n$ sudo docker compose up -d\n<\/pre><\/div>\n<h3>.env \u3092\u7de8\u96c6\u3059\u308b<\/h3>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u95a2\u9023\u306e\u8a2d\u5b9a\u3092\u3057\u307e\u3059\u3002<\/p>\n<div class='code'>\n<h5 class=\"source-file\">.env<\/h5>\n<pre >\nDB_CONNECTION=pgsql\nDB_HOST=db\nDB_PORT=5432\nDB_DATABASE=appdb\nDB_USERNAME=appuser\nDB_PASSWORD=secret\n<\/pre>\n<\/div>\n<h3>\u63a5\u7d9a\u3092\u78ba\u8a8d\u3059\u308b<\/h3>\n<p><code>artisan<\/code> \u306e <code>tinker<\/code> \u30b5\u30d6\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3046\u3068\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8d77\u52d5\u3057\u305f\u72b6\u614b\u3067\u3001PHP\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002\ndocker\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306f<code>sudo docker compose exec -it php bash<\/code> \u3057\u3066\u304b\u3089\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<div class='console'><pre>\n# .\/artisan tinker \n> DB::select('select 1')\n<p>= [\n{#7411\n+&quot;?column?&quot;: 1,\n},\n]\n<\/pre><\/div><\/p>\n<h2>\u30c6\u30fc\u30d6\u30eb\u3092\u3064\u304f\u308b<\/h2>\n<p>laravel\u3067\u30c6\u30fc\u30d6\u30eb\u3092\u3064\u304f\u308b\u306e\u306f\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3(migration)\u3068\u8a00\u3044\u307e\u3059\u3002\n\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306f\u5143\u3005\u79fb\u4f4f\u3068\u304b\u79fb\u52d5\u3068\u304b\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u304c\u3001\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u95a2\u4fc2\u3067\u306f\u5225\u306e\u74b0\u5883\u3078\u306e\u4e57\u308a\u63db\u3048\u3068\u3044\u3046\u610f\u5473\u3067\u4f7f\u308f\u308c\u307e\u3059\u3002\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30b9\u30ad\u30fc\u30de(\u30c6\u30fc\u30d6\u30eb\u306e\u69cb\u9020\u306b\u73fe\u308c\u308b\u67a0\u7d44\u307f)\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3092\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3068\u547c\u3076\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u30c6\u30fc\u30d6\u30eb\u306e\u5b9a\u7fa9\u3082PHP\u306e\u30b3\u30fc\u30c9\u3067\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u3001\u305d\u306e\u5909\u66f4\u3092<code>artisan<\/code>\u30b3\u30de\u30f3\u30c9\u3067\u7ba1\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class='console'>\n# .\/artisan make:migration create_oligos_table\n<\/pre>\n<p>\u3053\u308c\u306b\u3088\u308a <code>database\/migrations<\/code> \u4ee5\u4e0b\u306b <code>2026_07_30_082653_create_oligos_table.php<\/code> \u304c\u4f5c\u3089\u308c\u307e\u3059\u3002\n\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u6570\u5b57\u306e\u90e8\u5206\u306f\u3001\u4f5c\u6210\u3057\u305f\u65e5\u6642\u306a\u3069\u304b\u3089\u306a\u308b\u91cd\u8907\u3057\u306a\u3044\u756a\u53f7\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4e0b\u8a18\u306e\u3088\u3046\u306b\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">database\/migrations\/2026_07_30_082653_create_oligos_table.php<\/h5>\n<pre >\n&lt;?php\n \nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n \nreturn new class extends Migration\n{\n    \/**\n     * Run the migrations.\n     *\/\n    public function up(): void\n    {\n        Schema::create(&#039;oligos&#039;, function (Blueprint $table) {\n            $table-&gt;id();\n            $table-&gt;string(&#039;name&#039;);\n            $table-&gt;string(&#039;sequence&#039;);\n            $table-&gt;float(&#039;concentration&#039;)-&gt;nullable(); \/\/ \u6fc3\u5ea6\u3002nullable\u3092\u3064\u3051\u308b\u3068\u3001\u5024\u304c\u306a\u304f\u3066\u3082\u3088\u3044\u3053\u3068\u306b\u306a\u308b\n            $table-&gt;string(&#039;box&#039;)-&gt;nullable();      \/\/ \u4fdd\u7ba1\u5834\u6240\n            $table-&gt;string(&#039;owner&#039;)-&gt;nullable();    \/\/ \u6240\u6709\u8005\n            $table-&gt;string(&#039;supplier&#039;)-&gt;nullable();    \/\/ \u8ca9\u58f2\u5143\n            $table-&gt;string(&#039;note&#039;)-&gt;nullable();\n            $table-&gt;timestamps();       \/\/ created_at, updated_at \u304c\u4f5c\u3089\u308c\u308b\n            $table-&gt;softDeletes();       \/\/ deleted_at \u304c\u4f5c\u3089\u308c\u308b\n        });\n    }\n \n    \/**\n     * Reverse the migrations.\n     *\/\n    public function down(): void\n    {\n        Schema::dropIfExists(&#039;oligos&#039;);\n    }\n};\n<\/pre>\n<\/div>\n<p>Blueprint\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e$table\u306b\u30e1\u30bd\u30c3\u30c9\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u306e\u578b\u3092\u6307\u5b9a\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u5217\u3092\u3064\u304f\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u3044\u304f\u3064\u304b\u4e0b\u306b\u793a\u3057\u307e\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u30e1\u30bd\u30c3\u30c9<\/th>\n<th>\u4f5c\u6210\u3055\u308c\u308b\u578b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>id<\/td>\n<td>\u81ea\u52d5\u63a1\u756a\u3067\u4e3b\u30ad\u30fc\u306b\u306a\u308b\u3002\u5f15\u6570\u3092\u7701\u7565\u3059\u308b\u3068id\u3068\u3044\u3046\u5217\u540d\u304c\u4f7f\u308f\u308c\u308b\u3002<\/td>\n<\/tr>\n<tr>\n<td>integer<\/td>\n<td>\u6574\u6570<\/td>\n<\/tr>\n<tr>\n<td>float<\/td>\n<td>\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570<\/td>\n<\/tr>\n<tr>\n<td>double<\/td>\n<td>float\u3088\u308a\u7cbe\u5ea6\u306e\u9ad8\u3044\u6d6e\u52d5\u5c0f\u6570\u70b9\u6570<\/td>\n<\/tr>\n<tr>\n<td>string<\/td>\n<td>\u6587\u5b57\u6570\u3092\u6307\u5b9a\u3057\u305f\u6587\u5b57\u5217\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f255\u6587\u5b57\u3002<\/td>\n<\/tr>\n<tr>\n<td>text<\/td>\n<td>\u9577\u3044\u6587\u5b57\u5217\u3002<\/td>\n<\/tr>\n<tr>\n<td>date<\/td>\n<td>\u65e5\u4ed8\u306e\u307f<\/td>\n<\/tr>\n<tr>\n<td>timestamp<\/td>\n<td>\u65e5\u6642<\/td>\n<\/tr>\n<tr>\n<td>timestamps<\/td>\n<td>created_at \u3068 updated_at\u304c\u3064\u304f\u3089\u308c\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u4f5c\u6210\u65e5\u6642\u3068\u66f4\u65b0\u65e5\u6642\u304c\u81ea\u52d5\u7684\u306b\u8a18\u9332\u3055\u308c\u308b\u3002<\/td>\n<\/tr>\n<tr>\n<td>softDeletes<\/td>\n<td>deleted_at\u304c\u3064\u304f\u3089\u308c\u3001null\u3067\u306a\u3044\u3068\u304d\u306b\u898b\u3048\u306a\u3044\u3088\u3046\u306b\u306a\u308b\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u30ec\u30b3\u30fc\u30c9\u306b\u5bfe\u3059\u308b\u5236\u7d04\u3092\u3064\u3051\u308b\u306b\u306f\u3001\u6b21\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u30e1\u30bd\u30c3\u30c9<\/th>\n<th>\u5236\u7d04<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>nullable<\/td>\n<td>null\u5024\u3092\u8a31\u5bb9\u3059\u308b\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306fNOT NULL\u306a\u306e\u3067\u3001\u3064\u3051\u306a\u3051\u308c\u3070NOT NULL\u306b\u306a\u308b\u3002<\/td>\n<\/tr>\n<tr>\n<td>default<\/td>\n<td>\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u5171\u901aID<\/h3>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30c6\u30fc\u30d6\u30eb\u3054\u3068\u306bid\u5217\u304c\u3064\u304f\u3089\u308c\u3001\u30b7\u30ea\u30a2\u30eb\u578b\u304c\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002\n\u3057\u304b\u3057\u3001\u3053\u306e\u65b9\u5f0f\u3067\u306f\u30ea\u30bd\u30fc\u30b9\u304c\u5897\u3048\u3066\u304d\u305f\u3068\u304d\u306b\u540c\u3058\u756a\u53f7\u306e\u3082\u306e\u304c\u3064\u3051\u3089\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059(\u4f8b\u3048\u3070\u30aa\u30ea\u30b4DNA\u3068\u7a2e\u5b50\u306b\u540c\u3058id\u304c\u3075\u3089\u308c\u308b)\u3002\n\u57fa\u672c\u7684\u306b\u3053\u306eid\u3092\u30e6\u30fc\u30b6\u30fc\u304c\u610f\u8b58\u3059\u308b\u3053\u3068\u306f\u306a\u3044\u306e\u3067\u3001\u3053\u306e\u307e\u307e\u3067\u3082\u3088\u3044\u306e\u3067\u3059\u304c\u3001\u30ea\u30bd\u30fc\u30b9\u3068\u3057\u3066\u91cd\u8907\u3057\u306a\u3044\u756a\u53f7\u3092\u3064\u3051\u308b\u3088\u3046\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u5834\u5408\u3001\u30ea\u30bd\u30fc\u30b9\u306b\u3064\u3051\u308b\u756a\u53f7\u3092lab_id\u3068\u3057\u3066\u7ba1\u7406\u3057\u307e\u3059\u3002\n\u305d\u306e\u305f\u3081\u306b\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u6b21\u306e\u3088\u3046\u306b\u4fee\u6b63\u3057\u307e\u3059\u3002\n\u3053\u306e\u30b7\u30ea\u30a2\u30eb\u5024\u3092\u5b9a\u7fa9\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u3001\u3067\u304d\u308b\u3060\u3051\u5148\u982d\u306e\u307b\u3046\u306b\u304f\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<div class='console'><pre>\n# .\/artisan make:migration create_lab_id\n<\/pre><\/div>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">database\/migrations\/2026_07_30_000001_create_lab_id.php<\/h5>\n<pre >\n&lt;?php\n \nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\nuse Illuminate\\Support\\Facades\\DB;\n \nreturn new class extends Migration\n{\n    private const SEQUENCE = &#039;lab_id&#039;;\n \n    \/**\n     * Run the migrations.\n     *\/\n    public function up(): void\n    {\n        DB::statement(&quot;CREATE SEQUENCE IF NOT EXISTS &quot; . self::SEQUENCE);\n    }\n \n    \/**\n     * Reverse the migrations.\n     *\/\n    public function down(): void\n    {\n        DB::statement(&quot;DROP SEQUENCE IF EXISTS &quot; . self::SEQUENCE);\n    }\n};\n<\/pre>\n<\/div>\n<div class='code'>\n  <h5 class=\"source-file\">database\/migrations\/2026_07_30_082653_create_oligos_table.php<\/h5>\n<pre >\n&lt;?php\n \nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\nuse Illuminate\\Support\\Facades\\DB;\n \nreturn new class extends Migration\n{\n    private const SEQUENCE = &#039;lab_id&#039;;\n \n    \/**\n     * Run the migrations.\n     *\/\n    public function up(): void\n    {\n        Schema::create(&#039;oligos&#039;, function (Blueprint $table) {\n            $table-&gt;integer(&#039;id&#039;)\n                -&gt;primary()\n                -&gt;default(DB::raw(&quot;nextval(&#039;&quot; . self::SEQUENCE . &quot;&#039;)&quot;));\n            $table-&gt;string(&#039;name&#039;);\n            $table-&gt;string(&#039;sequence&#039;);\n            $table-&gt;float(&#039;concentration&#039;)-&gt;nullable(); \/\/ \u6fc3\u5ea6\u3002nullable\u3092\u3064\u3051\u308b\u3068\u3001\u5024\u304c\u306a\u304f\u3066\u3082\u3088\u3044\u3053\u3068\u306b\u306a\u308b\n            $table-&gt;string(&#039;box&#039;)-&gt;nullable();      \/\/ \u4fdd\u7ba1\u5834\u6240\n            $table-&gt;string(&#039;owner&#039;)-&gt;nullable();    \/\/ \u6240\u6709\u8005\n            $table-&gt;string(&#039;supplier&#039;)-&gt;nullable();    \/\/ \u8ca9\u58f2\u5143\n            $table-&gt;string(&#039;note&#039;)-&gt;nullable();\n            $table-&gt;timestamps();       \/\/ created_at, updated_at \u304c\u4f5c\u3089\u308c\u308b\n            $table-&gt;softDeletes();       \/\/ deleted_at \u304c\u4f5c\u3089\u308c\u308b\n        });\n    }\n \n    \/**\n     * Reverse the migrations.\n     *\/\n    public function down(): void\n    {\n        Schema::dropIfExists(&#039;oligos&#039;);\n    }\n};\n<\/pre>\n<\/div>\n<h3>\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210<\/h3>\n<p>artisan\u306emigration\u30b5\u30d6\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001migrations\u30d5\u30a9\u30eb\u30c0\u306b\u3042\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u4e00\u5ea6\u3060\u3051\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<div class='console'><pre>\n# .\/artisan migrate\n<\/pre><\/div>\n<p>laravel\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6642\u306b\u3042\u308busers, cache, jobs\u30c6\u30fc\u30d6\u30eb\u3082\u3064\u304f\u3089\u308c\u308b\u3002\u307e\u305f\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u7ba1\u7406\u7528\u306e\u30c6\u30fc\u30d6\u30eb\u3082\u3067\u304d\u308b\u3002<\/p>\n<pre class='console'>\n$ sudo docker compose exec -it db psql -U appuser appdb\nappdb=# \\d\n                  List of relations\n Schema |         Name          |   Type   |  Owner\n--------+-----------------------+----------+---------\n public | cache                 | table    | appuser\n public | cache_locks           | table    | appuser\n public | failed_jobs           | table    | appuser\n public | failed_jobs_id_seq    | sequence | appuser\n public | job_batches           | table    | appuser\n public | jobs                  | table    | appuser\n public | jobs_id_seq           | sequence | appuser\n public | lab_id                | sequence | appuser\n public | migrations            | table    | appuser\n public | migrations_id_seq     | sequence | appuser\n public | oligos                | table    | appuser\n public | password_reset_tokens | table    | appuser\n public | sessions              | table    | appuser\n public | users                 | table    | appuser\n public | users_id_seq          | sequence | appuser\n(15 rows) \n<\/pre>\n<h2>\u521d\u671f\u30c7\u30fc\u30bf\u3092\u6295\u5165\u3059\u308b<\/h2>\n<p>csv\u3067\u4fdd\u5b58\u3057\u3066\u3042\u3063\u305f\u30aa\u30ea\u30b4DNA\u306e\u30c7\u30fc\u30bf\u3092\u3044\u308c\u307e\u3059\u3002<\/p>\n<h3>\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u52d5\u304b\u3059\u30b3\u30de\u30f3\u30c9\u306e\u4f5c\u6210<\/h3>\n<p><code>artisan<\/code>\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u52d5\u304b\u3059\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u3064\u308a\u307e\u3059\u3002<\/p>\n<pre class='console'>\n# .\/artisan make:command ImportOligo\n<\/pre>\n<p>\u3053\u308c\u306b\u3088\u3063\u3066 <code>app\/Console\/Commands\/ImportOligo.php<\/code> \u304c\u4f5c\u3089\u308c\u308b\u3002\n\u3053\u308c\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4fee\u6b63\u3059\u308b\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Console\/Commands\/ImportOligo.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Console\\Commands;\n \nuse Illuminate\\Console\\Attributes\\Description;\nuse Illuminate\\Console\\Attributes\\Signature;\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\DB;\n \n#[Signature(&#039;app:import-oligo&#039;)]\n#[Description(&#039;Import oligo data from a CSV file&#039;)]\nclass ImportOligo extends Command\n{\n    public function handle()\n    {\n        $csv = storage_path(&#039;app\/private\/oligo.csv&#039;);\n        $table = &#039;oligos&#039;;\n \n        $fp = fopen($csv, &#039;r&#039;);\n        $items = [];\n        while($row = fgetcsv($fp)){\n            $item = array_combine([&#039;name&#039;, &#039;sequence&#039;, &#039;created_at&#039;, &#039;owner&#039;], $row);\n            try{\n                DB::table($table)-&gt;insert($item);\n            } catch (\\Throwable $e) {\n                var_dump($item);\n                $this-&gt;error(&quot;Failed to insert row into table: ${table}&quot;);\n                return self::FAILURE;\n            }\n        }\n        fclose($fp);\n        return self::SUCCESS;\n    }\n}\n<\/pre>\n<\/div>\n<p>class\u540d\u306e\u4e0a\u306e\u90e8\u5206\u306b\u3042\u308b<code>#[Signature('app:import-oligo')]<\/code> \u306f\u30a2\u30c8\u30ea\u30d3\u30e5\u30fc\u30c8(\u5c5e\u6027)\u3067\u3001\u7d9a\u304fclass\u306e\u30e1\u30bf\u30c7\u30fc\u30bf\u3068\u306a\u308a\u307e\u3059\u3002\nIlluminate\\Console\\Command \u30af\u30e9\u30b9\u306f\u3053\u308c\u3092\u30ea\u30d5\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u3088\u3063\u3066\u8aad\u307f\u8fbc\u307f\u3001\u30af\u30e9\u30b9\u5909\u6570\u306esignature\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\n\u3053\u306e\u5024\u306f <code>artisan<\/code>\u306e\u30b5\u30d6\u30b3\u30de\u30f3\u30c9\u3068\u3057\u3066\u306f\u305f\u3089\u304d\u3001<code>handle<\/code>\u30e1\u30bd\u30c3\u30c9\u304c\u547c\u3070\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><code>#[Description('Import oligo data from a CSV file')]<\/code> \u3082\u540c\u3058\u3067\u3059\u3002<\/p>\n<h3>\u5b9f\u884c<\/h3>\n<p>\u3067\u304d\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4e0b\u8a18\u306e\u3088\u3046\u306b\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class='console'>\n# .\/artisan app:import-oligo \n<\/pre>\n<h2>\u30c6\u30fc\u30d6\u30eb\u3092CSV\u3067\u51fa\u529b\u3059\u308b<\/h2>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u3092CSV\u5f62\u5f0f\u3067\u51fa\u529b\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30b3\u30de\u30f3\u30c9\u3092\u3064\u304f\u308b<\/h3>\n<p><\/p>\n<pre class='console'>\n# .\/artisan make:command ExportTable\n<\/pre>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Console\/Commands\/ExportTable.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Console\\Commands;\n \nuse Illuminate\\Console\\Attributes\\Description;\nuse Illuminate\\Console\\Attributes\\Signature;\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\DB;\n \n#[Signature(&#039;app:export-table {table}&#039;)]\n#[Description(&#039;Export table data to a CSV file&#039;)]\nclass ExportTable extends Command\n{\n    public function handle()\n    {\n        $table = $this-&gt;argument(&#039;table&#039;);\n \n        $path_template = join(&#039;-&#039;, [$table, now()-&gt;format(&#039;ymd&#039;), &#039;%02d.csv&#039;]);\n        $n = 1;\n \n        \/\/ \u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u9593\u306f\u756a\u53f7\u3092\u5897\u3084\u3057\u3066\u30eb\u30fc\u30d7\u3092\u7d9a\u3051\u308b\n        do {\n            $csv = storage_path(&quot;app\/private\/&quot; . sprintf($path_template, $n++));\n        } while (file_exists($csv));\n \n        try{\n            $rows = DB::table($table)-&gt;get();\n        } catch (\\Throwable $e) {\n            $this-&gt;error(&quot;Failed to fetch rows from table: ${table}&quot;);\n            return self::FAILURE;\n        }\n \n        if ($rows-&gt;isEmpty()) {\n            $this-&gt;warn(&quot;No rows found in table: {$table}&quot;);\n            return self::SUCCESS;\n        }\n \n        $out = fopen($csv, &#039;w&#039;);\n \n        \/\/ \u30d8\u30c3\u30c0\u30fc\u884c\n        fputcsv($out, array_keys((array) $rows-&gt;first()));\n \n        \/\/ \u30c7\u30fc\u30bf\u884c\n        foreach ($rows as $row) {\n            fputcsv($out, (array) $row);\n            $this-&gt;warn(&quot;Exported row: &quot; . json_encode($row));\n        }\n \n        fclose($out);\n        $this-&gt;info(&quot;Exported to $csv.&quot;);\n \n        return self::SUCCESS;\n    }\n}\n<\/pre>\n<\/div>\n<h3>\u5b9f\u884c\u3059\u308b<\/h3>\n<pre class='console'>\n# .\/artisan app:export-table oligos \n<\/pre>\n<h2>Eloquent\u3092\u4f7f\u3046<\/h2>\n<p>Eloquent\u306f\u3001Laravel\u6a19\u6e96\u306e\u3001Object Relational Mapper (ORM)\u3067\u3059\u3002\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u3068\u3001PHP\u306e\u30af\u30e9\u30b9\u3092\u5bfe\u5fdc\u3065\u3051\u3066\u3001SQL\u3092\u4f7f\u308f\u305a\u306b\u5165\u51fa\u529b\u306a\u3069\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u3084\u305d\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u8868\u3059\u3082\u306e\u3092<code>\u30e2\u30c7\u30eb<\/code>\u3068\u547c\u3073\u307e\u3059\u3002\n\u8868\u3092PHP\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u53d6\u308a\u51fa\u3057\u3092SQL\u3067\u306f\u306a\u304f\u3001\u30e1\u30bd\u30c3\u30c9\u3067\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\n\u307e\u305f\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u4f5c\u6210\u3001\u66f4\u65b0\u3084\u524a\u9664\u3082\u30e1\u30bd\u30c3\u30c9\u3092\u901a\u3058\u3066\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Models\/Oligo.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Models;\n \nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Database\\Eloquent\\SoftDeletes;\n \nclass Oligo extends Model\n{\n    use SoftDeletes; \/\/ delete\u3057\u305f\u3068\u304d\u306b\u3001\u5b9f\u969b\u306b\u524a\u9664\u305b\u305a\u3001deleted_at\u306b\u6642\u523b\u3092\u8a2d\u5b9a\u3059\u308b\n \n    \/\/  \u8868\u793a\u3057\u306a\u3044\u5217\u3092\u6307\u5b9a\u3059\u308b (toArray, json\u306a\u3069\u3067\u51fa\u529b\u3055\u308c\u306a\u3044)\n    protected $hidden = [&#039;deleted_at&#039;];\n}\n<\/pre>\n<\/div>\n<h3>\u4e00\u89a7\u8868\u793a\u306b\u4f7f\u7528\u3059\u308b<\/h3>\n<p>\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\u5143\u3092CSV\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5909\u66f4\u3057\u307e\u3059\u3002\n<\/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;\nuse App\\Models\\Oligo; \/\/ Oligo\u30e2\u30c7\u30eb\u3092\u4f7f\u3046\n \nclass OligoController\n{\n    public function index(){\n        $items = Oligo::all();  \/\/ \u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u53d6\u5f97\u3059\u308b\n        return view(&#039;oligo.index&#039;, compact(&#039;items&#039;))\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>\u30d3\u30e5\u30fc\u3082\u5c11\u3057\u4fee\u6b63\u3057\u3066\u3001ID\u3082\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002\n\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u8868\u793a\u306f <code>$item['name']<\/code> \u306e\u307e\u307e\u3067\u3059\u304c\u3001 <code>$item-&gt;name<\/code> \u306e\u3088\u3046\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u3082\u66f8\u3051\u307e\u3059\u3002\n<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/oligo\/index.blade.php<\/h5>\n<pre >\n@extends(&#039;oligo.module&#039;)\n \n@section(&#039;feature&#039;)\n&lt;x-feature id=&#039;oligo-index&#039;&gt;\n  &lt;table&gt;\n    &lt;thead&gt;\n      &lt;tr&gt;&lt;th&gt;id&lt;\/th&gt;&lt;th&gt;\u540d\u524d&lt;\/th&gt;&lt;th&gt;\u914d\u5217&lt;\/th&gt;&lt;th&gt;\u4f5c\u6210\u65e5&lt;\/th&gt;&lt;th&gt;\u6240\u6709\u8005&lt;\/th&gt;&lt;\/tr&gt;\n    &lt;\/thead&gt;\n    &lt;tbody&gt;\n      @foreach($items as $item) {{-- \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304b\u3089\u6e21\u3055\u308c\u305f$items\u3092\u8868\u793a\u3059\u308b --}}\n        &lt;tr&gt;\n          &lt;td&gt;{{ $item[&#039;id&#039;] }}&lt;\/td&gt;  {{-- $item-&gt;id \u3068\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b --}}\n          &lt;td&gt;{{ $item[&#039;name&#039;] }}&lt;\/td&gt;\n          &lt;td&gt;{{ $item[&#039;sequence&#039;] }}&lt;\/td&gt;\n          &lt;td&gt;{{ $item[&#039;created_at&#039;] }}&lt;\/td&gt;\n          &lt;td&gt;{{ $item[&#039;owner&#039;] }}&lt;\/td&gt;\n        &lt;\/tr&gt;\n      @endforeach\n    &lt;\/tbody&gt;\n  &lt;\/table&gt;\n&lt;\/x-feature&gt;\n@endsection\n<\/pre>\n<\/div>\n<h3>\u30c7\u30fc\u30bf\u306e\u767b\u9332\u306b\u4f7f\u7528\u3059\u308b<\/h3>\n<p>\u9023\u60f3\u914d\u5217\u3067\u30c7\u30fc\u30bf\u3092\u6e21\u3057\u307e\u3059\u304c\u3001\u305d\u306e\u3068\u304d\u306b\u30d5\u30a3\u30fc\u30eb\u30c9\u3068\u3057\u3066\u6709\u52b9\u306a\u30ad\u30fc\u3092fillable\u3068\u3057\u3066\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Models\/Oligo.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Models;\n \nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Database\\Eloquent\\SoftDeletes;\nuse Illuminate\\Database\\Eloquent\\Attributes\\Fillable;\n \n\/*\n * Fillable\u3067\u6307\u5b9a\u3057\u305f\u5217\u306fcreate\u3068\u304bupdate\u3067\u65b0\u3057\u3044\u5024\u3092\u914d\u5217\u3068\u3057\u3066\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\n * \u3053\u3053\u306b\u306a\u3044\u540d\u524d\u306f\u4e0e\u3048\u3089\u308c\u305f\u3068\u3057\u3066\u3082\u7121\u8996\u3055\u308c\u308b\u3002[&#039;id&#039; =&gt; 123] \u3068\u3044\u3046\u306e\u3092\u6e21\u3055\u308c\u305f\u3068\u3057\u3066\u3082id\u306f\u66f4\u65b0\u3055\u308c\u306a\u3044\u3002\n *\/\n#[Fillable([&#039;name&#039;, &#039;sequence&#039;, &#039;concentration&#039;, &#039;box&#039;, &#039;owner&#039;, &#039;note&#039;, &#039;created_at&#039;, &#039;updated_at&#039;])]\nclass Oligo extends Model\n{\n    use SoftDeletes;\n \n    protected $hidden = [&#039;deleted_at&#039;];\n}\n<\/pre>\n<\/div>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u30c7\u30fc\u30bf\u3092\u30e2\u30c7\u30eb\u306b\u6e21\u3057\u3066\u3001\u30c6\u30fc\u30d6\u30eb\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/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;\nuse App\\Models\\Oligo; \/\/ Oligo\u30e2\u30c7\u30eb\u3092\u4f7f\u3046\n \nclass OligoController\n{\n    public function index(){\n        $items = Oligo::all();  \/\/ \u3059\u3079\u3066\u306e\u30ec\u30b3\u30fc\u30c9\u3092\u53d6\u5f97\u3059\u308b\n        return view(&#039;oligo.index&#039;, compact(&#039;items&#039;))\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        Oligo::create($validated);\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<h3>\u65e5\u4ed8\u306e\u8868\u793a\u65b9\u6cd5\u3092\u5909\u66f4\u3059\u308b<\/h3>\n<p>\u7814\u7a76\u5ba4\u3067\u306f\u65e5\u4ed8\u3092\u3088\u304f6\u6841\u306e\u6570\u5b57\u3067\u8868\u3057\u307e\u3059\u3002<code>date('ymd')<\/code> \u3068\u3044\u3046\u611f\u3058\u3067\u3059\u3002\n\u3053\u306e\u5f62\u5f0f\u3092\u53d6\u308a\u6271\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u8907\u6570\u306e\u30c6\u30fc\u30d6\u30eb\u3067\u4f7f\u7528\u3059\u308b\u306e\u3067\u3001Trait\u3068\u3057\u3066\u3064\u304f\u308a\u307e\u3059\u3002\n<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Traits\/ConvertsYmdDate.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Traits;\n \nuse Carbon\\Carbon;\n \ntrait ConvertsYmdDate\n{\n    \/**\n     * 6\u6841\u306e\u6570\u5b57 (YYMMDD) \u2192 \u65e5\u4ed8 (YYYY-MM-DD)\n     *\/\n    protected function ymdToDate(string $ymd): string\n    {\n        if(preg_match(&#039;\/^\\d{6}$\/&#039;, $ymd)){\n            return Carbon::createFromFormat(&#039;ymd&#039;, $ymd)-&gt;startOfDay();\n        }\n        return $ymd;\n    }\n \n    \/**\n     * \u65e5\u4ed8 (YYYY-MM-DD) \u2192 6\u6841\u306e\u6570\u5b57 (YYMMDD)\n     *\/\n    protected function dateToYmd(string $date): string\n    {\n        \/\/ Carbon \u3092\u4f7f\u3063\u3066\u5b89\u5168\u306b\u5909\u63db\n        return Carbon::parse($date)-&gt;format(&#039;ymd&#039;);\n    }\n}\n<\/pre>\n<\/div>\n<p>\u30e2\u30c7\u30eb\u3092\u4fee\u6b63\u3057\u3066\u3001created_at\u3068updated_at\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u304d\u306b\u3001Trait\u3067\u5b9a\u7fa9\u3057\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Models\/Oligo.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Models;\n \nuse Illuminate\\Database\\Eloquent\\Model;\nuse Illuminate\\Database\\Eloquent\\SoftDeletes;\nuse Illuminate\\Database\\Eloquent\\Attributes\\Fillable;\nuse Illuminate\\Database\\Eloquent\\Casts\\Attribute;  # \nuse App\\Traits\\ConvertsYmdDate;\n \n#[Fillable([&#039;name&#039;, &#039;sequence&#039;, &#039;concentration&#039;, &#039;box&#039;, &#039;owner&#039;, &#039;note&#039;, &#039;created_at&#039;, &#039;updated_at&#039;])]\nclass Oligo extends Model\n{\n    use SoftDeletes;\n    use ConvertsYmdDate;\n \n    \/\/  \u8868\u793a\u3057\u306a\u3044(toArray, json\u306a\u3069\u3067\u51fa\u529b\u3055\u308c\u306a\u3044)\n    protected $hidden = [&#039;deleted_at&#039;];\n    protected function createdAt(): Attribute\n    {\n        return Attribute::make(\n            get: function ($value, $attributes) {\n                return isset($attributes[&#039;created_at&#039;])\n                    ? $this-&gt;dateToYmd($attributes[&#039;created_at&#039;])\n                    : null;\n            },\n            set: function ($value) {\n                return [&#039;created_at&#039; =&gt; $value ? $this-&gt;ymdToDate($value) : null];\n            },\n        );\n    }\n \n    protected function updatedAt(): Attribute\n    {\n        return Attribute::make(\n            get: function ($value, $attributes) {\n                return isset($attributes[&#039;updated_at&#039;])\n                    ? $this-&gt;dateToYmd($attributes[&#039;updated_at&#039;])\n                    : null;\n            },\n \n            set: function ($value) {\n                return [&#039;updated_at&#039; =&gt; $value ? $this-&gt;ymdToDate($value) : null];\n            }\n        );\n    }\n}\n<\/pre>\n<\/div>\n<h2>\u691c\u7d22<\/h2>\n<p>\u30c6\u30fc\u30d6\u30eb\u3092\u691c\u7d22\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\u5fc5\u8981\u306a\u3082\u306e\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u691c\u7d22\u7528\u306e\u30d5\u30a9\u30fc\u30e0 -&gt; index.blade.php\u306b\u3064\u304f\u308b\u3002<\/li>\n<li>\u691c\u7d22\u30af\u30a8\u30ea\u306e\u9001\u4fe1 -&gt; Javascript\u306efetch\u3067\/oligo\/search\u306b\u9001\u4fe1\u3059\u308b\u3002<\/li>\n<li>\u30af\u30a8\u30ea\u306e\u53d7\u4fe1 -&gt; web.php\u3067search\u30eb\u30fc\u30c8\u3092\u5b9a\u7fa9\u3002OligoController\u3078\u9001\u308b\u3002<\/li>\n<li>\u691c\u7d22\u30af\u30a8\u30ea\u306e\u691c\u8a3c -&gt; OligoSearchRequest\u3067\u884c\u3046\u3002<\/li>\n<li>SQL\u306e\u5b9f\u884c -&gt; OligoService\u306b\u3064\u304f\u308b\u3002<\/li>\n<li>\u691c\u7d22\u7d50\u679c\u306e\u9001\u4fe1 -&gt; JSON\u3067\u9001\u308b\u3002index.blade.php\u3067\u8868\u306b\u3059\u308b\u3002<\/li>\n<\/ol>\n<h3>\u691c\u7d22\u30d5\u30a9\u30fc\u30e0\u3092\u3064\u304f\u308b<\/h3>\n<p>\u30d5\u30a9\u30fc\u30e0(input\u30bf\u30b0\u306a\u3069)\u3092 <code>resources\/views\/oligo\/index.blade.php<\/code> \u306b\u3064\u304f\u308b\u3002\n\u30d5\u30a9\u30fc\u30e0\u306e\u8981\u7d20\u306b\u306fx-model\u3092\u8a2d\u5b9a\u3057\u3001Javascript\u3067\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/oligo\/index.blade.php<\/h5>\n<pre >\n@extends(&#039;oligo.module&#039;)\n \n@section(&#039;feature&#039;)\n&lt;x-feature id=&#039;oligo-index&#039;&gt;\n  &lt;table\n    class=&#039;border-2 border-cyan-600&#039;\n \n    {{-- x-init\u306fAlpine.js\u304c\u51e6\u7406\u3057\u3001items\u3092\u8a2d\u5b9a\u3059\u308b --}}\n    x-init=&quot;items = @js($items)&quot;  {{-- @js\u306fBlade\u306e\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3002$items\u3092JSON\u306b\u3059\u308b\u3002 --}}\n  &gt;\n    &lt;thead&gt;\n      {{-- thead 1\u884c\u76ee \u898b\u51fa\u3057 --}}\n      &lt;tr class=&#039;bg-cyan-400 border-cyan-600 border-t-2&#039;&gt;\n        &lt;th&gt;&lt;\/th&gt;\n        &lt;th&gt;{{ __(&#039;\u540d\u524d&#039;) }}&lt;\/th&gt;\n        &lt;th&gt;{{ __(&#039;\u914d\u5217&#039;) }}&lt;\/th&gt;\n        &lt;th&gt;{{ __(&#039;\u4f5c\u6210\u65e5&#039;) }}&lt;\/th&gt;\n        &lt;th&gt;{{ __(&#039;\u66f4\u65b0\u65e5&#039;) }}&lt;\/th&gt;\n        &lt;th&gt;{{ __(&#039;\u4f5c\u6210\u8005&#039;) }}&lt;\/th&gt;\n        &lt;th&gt;&lt;\/th&gt;\n      &lt;\/tr&gt;\n \n      {{-- thead 2\u884c\u76ee \u30d5\u30a9\u30fc\u30e0 --}}\n      {{-- @input\u306fAlpine.js\u306e\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u3002\u5165\u529b\u5024\u304c\u5909\u66f4\u306b\u306a\u3063\u305f\u3068\u304d\u306b\u5b9f\u884c\u3059\u308bJavascript\u3092\u8a2d\u5b9a\u3059\u308b\n        -- .debounce.500\u3092\u5f8c\u306b\u3064\u3051\u308b\u3053\u3068\u3067\u3001500\u30df\u30ea\u79d2\u9045\u5ef6\u3055\u305b\u308b\u3002\n        --}}\n      &lt;tr @input.debounce.500=&quot;search()&quot; class=&quot;border-cyan-600 border-b-2 align-text-top&quot;&gt;\n        &lt;th&gt;\u691c\u7d22&lt;\/th&gt;\n        &lt;td class=&quot;name&quot;&gt;\n          {{-- x-model\u306fAlpine.js\u304c\u51e6\u7406\u3059\u308b\u3002\u30d5\u30a9\u30fc\u30e0\u306e\u5165\u529b\u5024\u304c\u5909\u66f4\u3055\u308c\u308b\u3068\u5909\u6570\u306e\u5024\u3092\u5909\u3048\u3001\u5909\u6570\u306e\u5024\u304c\u5909\u308f\u308b\u3068\u30d5\u30a9\u30fc\u30e0\u306e\u5024(\u898b\u305f\u76ee)\u304c\u5909\u308f\u308b --}}\n          &lt;input x-model=&quot;query.name&quot; placeholder=&quot;DROL1&quot;&gt;\n          &lt;label&gt;\n              &lt;input type=&quot;checkbox&quot; x-model=&quot;query.use_regex&quot; value=1 title=&quot;\u6b63\u898f\u8868\u73fe&quot;&gt;\n              \u6b63\u898f\u8868\u73fe\n          &lt;\/label&gt;\n        &lt;\/td&gt;\n        &lt;td class=&#039;sequence&#039;&gt;\n          &lt;input x-model=&quot;query.sequence&quot; placeholder=&quot;ATCG...&quot;&gt;\n        &lt;\/td&gt;\n        &lt;td class=&#039;date&#039;&gt;\n          &lt;input x-model=&quot;query.created_at&quot; placeholder=&quot;260101&quot;\n            title=&quot;6\u6841\u306e\u6570\u5b57\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002-\u3067\u7bc4\u56f2\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002&quot;\n          &gt;\n        &lt;\/td&gt;\n        &lt;td class=&#039;date&#039;&gt;\n          &lt;input x-model=&quot;query.updated_at&quot; placeholder=&quot;260201&quot;\n            title=&quot;6\u6841\u306e\u6570\u5b57\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002-\u3067\u7bc4\u56f2\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002&quot;\n          &gt;\n        &lt;\/td&gt;\n        &lt;td class=&#039;owner&#039;&gt;\n          &lt;input x-model=&quot;query.owner&quot;&gt;\n        &lt;\/td&gt;\n        &lt;td&gt;&lt;\/td&gt;\n      &lt;\/tr&gt;\n \n      {{-- thead 3\u884c\u76ee \u30dc\u30bf\u30f3 --}}\n      &lt;tr&gt;\n        &lt;td colspan=&quot;9&quot; class=&#039;px-2 py-2&#039;&gt;\n          &lt;button @click=&quot;search()&quot;&gt;  {{-- @input\u3067\u81ea\u52d5\u5b9f\u884c\u3055\u308c\u308b\u304c\u3001\u30dc\u30bf\u30f3\u3082\u52a0\u3048\u3066\u304a\u304f --}}\n            \u691c\u7d22\n            &lt;x-ajax-state var=&#039;query&#039; \/&gt;\n          &lt;\/button&gt;\n \n          {{-- \u30c1\u30a7\u30c3\u30af\u30dc\u30bf\u30f3\u3067\u9078\u629e\u30fb\u975e\u9078\u629e\u3092\u3059\u308b --}}\n          &lt;button @click.prevent=&quot;\n            $el.closest(&#039;table&#039;)\n              .querySelector(&#039;tbody&#039;)\n              .querySelectorAll(&#039;input[type=checkbox]&#039;)\n              .forEach(cb =&gt; cb.click())\n            &quot;\n          &gt;\n            \u30c1\u30a7\u30c3\u30af\u3092\u53cd\u8ee2\n          &lt;\/button&gt;\n \n          &lt;button @click=&quot;query = {}&quot;&gt;\u6761\u4ef6\u30af\u30ea\u30a2&lt;\/button&gt;\n        &lt;\/td&gt;\n      &lt;\/tr&gt;\n \n      {{-- thead 4\u884c\u76ee \u691c\u7d22\u7d50\u679c --}}\n      &lt;tr class=&#039;border-cyan-600 border-b-2&#039;&gt;\n        &lt;td x-show=&quot;items.length == 0&quot; colspan=&quot;9&quot;&gt;\n          \u6761\u4ef6\u306b\u5408\u3046\u3082\u306e\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\n        &lt;\/td&gt;\n        &lt;td x-show=&quot;items.length &gt; 0&quot; colspan=&quot;9&quot;&gt;\n          \u691c\u7d22\u7d50\u679c: &lt;span x-text=&quot;items.length&quot;&gt;&lt;\/span&gt;\u4ef6\n          query:\n          &lt;template x-for=&quot;key in Object.keys(query)&quot; :key=&quot;key&quot;&gt;\n            &lt;template x-if=&quot;query[key] !== undefined &amp;&amp; query[key] !== &#039;&#039;&quot;&gt;\n              &lt;span x-text=&quot;key&quot;&gt;&lt;\/span&gt;=&lt;span x-text=&quot;query[key]&quot;&gt;&lt;\/span&gt;\n            &lt;\/template&gt;\n          &lt;\/template&gt;\n        &lt;\/td&gt;\n      &lt;\/tr&gt;\n    &lt;\/thead&gt;\n \n    &lt;tbody&gt;\n      {{-- \u691c\u7d22\u7d50\u679c --}}\n      {{-- Alpine.js (x-for)\u306b\u3088\u3063\u3066\u3001items\u914d\u5217\u306e\u305d\u308c\u305e\u308c\u306e\u8981\u7d20\u3092item\u306b\u53d6\u308a\u51fa\u3057\u3001template\u8981\u7d20\u3092\u5897\u3084\u3059 --}}\n      &lt;template x-for=&quot;item in items&quot; :key=&quot;item.id&quot;&gt;\n        &lt;tr&gt;\n          &lt;td&gt;&lt;input x-model=&quot;item.checked&quot; type=&#039;checkbox&#039;&gt;&lt;\/td&gt;\n          &lt;td x-text=&quot;item.name&quot; class=&quot;name&quot;&gt;&lt;\/td&gt;\n          &lt;td x-text=&quot;item.sequence&quot; class=&quot;sequence&quot;&gt;&lt;\/td&gt;\n          &lt;td x-text=&quot;item.created_at&quot; class=&quot;date&quot;&gt;&lt;\/td&gt;\n          &lt;td x-text=&quot;item.updated_at&quot; class=&quot;date&quot;&gt;&lt;\/td&gt;\n          &lt;td x-text=&quot;item.owner&quot; class=&quot;owner&quot;&gt;&lt;\/td&gt;\n          &lt;td x-text=&quot;item.id&quot;&gt;&lt;\/td&gt;\n        &lt;\/tr&gt;\n      &lt;\/template&gt;\n    &lt;\/tbody&gt;\n  &lt;\/table&gt;\n&lt;\/x-feature&gt;\n@endsection\n<\/pre>\n<\/div>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/components\/ajax-state.blade.php<\/h5>\n<pre >\n@props([&#039;var&#039; =&gt; &#039;item&#039;])\n&lt;template x-if=&quot;{{ $var }}.status === &#039;loading&#039;&quot;&gt;\n  &lt;span style=&quot;color: gray;&quot;&gt;\u23f3&lt;\/span&gt;\n&lt;\/template&gt;\n \n&lt;template x-if=&quot;{{ $var }}.status === &#039;success&#039;&quot;&gt;\n  &lt;span style=&quot;color: green;&quot;&gt;\u2714&lt;\/span&gt;\n&lt;\/template&gt;\n \n&lt;template x-if=&quot;{{ $var }}.status === &#039;error&#039;&quot;&gt;\n  &lt;span style=&quot;color: red;&quot;&gt;\u2716&lt;\/span&gt;\n&lt;\/template&gt;\n<\/pre>\n<\/div>\n<p>\u8868\u3084\u30dc\u30bf\u30f3\u306e\u5916\u89b3 (CSS) \u3092\u30e2\u30b8\u30e5\u30fc\u30eb\u5185\u3067\u305d\u308d\u3048\u308b\u305f\u3081\u306b\u3001<code>resources\/css\/oligo.css<\/code> \u3092\u3064\u304f\u308b\u3002\n\u3053\u308c\u306f <code>resources\/css\/app.css<\/code> \u3067@import\u3059\u308b\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/css\/oligo.css<\/h5>\n<pre >\n#oligo {\n    table {\n        thead th,thead td {\n            @apply border-x border-cyan-600;\n        }\n \n        td {\n            @apply border-x border-cyan-600 p-1;\n        }\n        td input {\n            &amp;[type=text], &amp;:not([type]) {\n                @apply border border-cyan-600 w-full min-w-0 px-1 h-[24px];\n            }  \n        }\n \n        .name {\n            width: 10em;\n        }\n        .owner {\n            width: 5em;\n        }\n        .date, .created_at, .updated_at {\n            width: 8em;\n        }\n        .note {\n            width: 15em;\n        }\n        .sequence {\n            @apply font-mono text-sm w-[30em] h-[24px];\n        }\n    }\n \n    button {\n        @apply border-cyan-600 bg-cyan-200;\n        &amp;:hover {\n            @apply bg-cyan-600 text-white;\n        }\n    }\n}\n<\/pre>\n<\/div>\napp.css\u306b@import &#8220;oligo.css&#8221;; \u3092\u52a0\u3048\u308b\u3002\n<h3>\u30af\u30a8\u30ea\u306e\u9001\u4fe1<\/h3>\n<p>\u691c\u7d22\u30d5\u30a9\u30fc\u30e0\u306e\u5024(query)\u3092Ajax\u3067\u9001\u4fe1\u3059\u308b\u30b3\u30fc\u30c9\u3092 #features \u306b\u5b9a\u7fa9\u3059\u308b\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              @click.prevent=&quot;selectTab(event)&quot;\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;div class=&#039;features&#039;\n      {{-- oligo\u30e2\u30b8\u30e5\u30fc\u30eb\u5168\u4f53\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3053\u3053\u306bx-data\u3092\u5b9a\u7fa9\u3059\u308b --}}\n      x-data=&quot;{\n        items: [], \/\/ \u30c6\u30fc\u30d6\u30eb\u304b\u3089\u62bd\u51fa\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3002\u4eca\u5f8c\u66f4\u65b0\u3084\u524a\u9664\u306e\u6a5f\u80fd\u3067\u3082\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u3053\u3053(#features)\u306b\u5b9a\u7fa9\u3059\u308b\u3002\n        query: {}, \/\/ \u691c\u7d22\u306e\u6761\u4ef6\u3002x-model\u3068\u3057\u3066\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u306e\u5024\u304c\u305d\u306e\u307e\u307eJavascript\u3067\u4f7f\u7528\u3067\u304d\u308b\n \n        \/\/ \u691c\u7d22 fetch\u306f\u975e\u540c\u671f(async)\u306b\u5b9f\u884c\u3055\u308c\u308b\u306e\u3067\u3001\u305d\u308c\u306b\u305d\u308d\u3048\u308b\n        async search(){\n          const parameter = new URLSearchParams(this.query);  \/\/ \u540c\u3058x-data\u5185\u306a\u306e\u3067 this.query\u3068\u306a\u308b\u3002\u3053\u308c\u3092GET\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc(?key1=value1&amp;key2=value2)\u306b\u5909\u63db\u3059\u308b\n          console.log(&#039;parameter:&#039;, parameter.toString());  \/\/ \u52d5\u4f5c\u78ba\u8a8d\n          const options = {\n            method: &#039;GET&#039;,\n            headers: {\n              &#039;Accept&#039;: &#039;application\/json&#039;,  \/\/ \u8fd4\u308a\u5024\u306e\u8a2d\u5b9a\u3002Laravel\u304c\u5224\u65ad\u3059\u308b\u306e\u306b\u4f7f\u3046\u3002\n              &#039;Content-Type&#039;: &#039;application\/json&#039;,\n            },\n          };\n \n          return fetch(&#039;{{ route(&#039;web.oligo.search&#039;) }}?&#039; + parameter.toString(), options)\n            .then(response =&gt; response.json())\n            .then(response =&gt; {\n              console.log(&#039;search done&#039;, response);  \/\/ \u52d5\u4f5c\u78ba\u8a8d\n              return this.append(response.data.items);  \/\/ items\u3092\u7f6e\u304d\u63db\u3048\u308bappend\u3092\u547c\u3076\n            })\n            .catch(error =&gt; {debug(error)})\n          ;\n        },\n \n        \/\/ \u691c\u7d22\u7d50\u679c\u3092items\u306b\u53cd\u6620\u3055\u305b\u308b\u3002\u4eca\u5f8c\u3001\u65b0\u3057\u3044\u691c\u7d22\u7d50\u679c\u3067\u7f6e\u304d\u63db\u3048\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u8ffd\u52a0\u3059\u308b\u3088\u3046\u306b\u4fee\u6b63\u3057\u3066\u3044\u304f\u306e\u3067\u3001append\u3068\u3057\u3066\u3042\u308b\u3002\n        append(items){\n          this.items = items;\n        }\n      }&quot;\n    &gt;\n      @yield(&#039;feature&#039;)\n    &lt;\/div&gt;\n  &lt;\/x-module&gt;\n@endsection\n<\/pre>\n<\/div>\n<h3>\u30af\u30a8\u30ea\u306e\u53d7\u4fe1<\/h3>\n<p><\/p>\n<p><code>routes\/web.php<\/code> \u306bOligoController\u3078\u306e\u30eb\u30fc\u30c8\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">routes\/web.php<\/h5>\n<pre >\n&lt;?php\n \nuse Illuminate\\Support\\Facades\\Route;\nuse App\\Http\\Controllers\\OligoController;\n \nRoute::get(&#039;\/&#039;, function () {\n    return view(&#039;index&#039;);\n});\n \n\/*\n *\t\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u7d4c\u7531\u3059\u308b\u30eb\u30fc\u30c8\n *\/\nRoute::prefix(&#039;\/oligo&#039;)-&gt;as(&#039;web.oligo.&#039;)-&gt;group(function (){\n    Route::get(&#039;\/&#039;, [OligoController::class, &#039;index&#039;])-&gt;name(&#039;index&#039;);\n    Route::get(&#039;\/search&#039;, [OligoController::class, &#039;search&#039;])-&gt;name(&#039;search&#039;);\n    Route::get(&#039;\/create&#039;, [OligoController::class, &#039;create&#039;])-&gt;name(&#039;create&#039;);\n    Route::post(&#039;\/&#039;, [OligoController::class, &#039;store&#039;])-&gt;name(&#039;store&#039;);\n});\n<\/pre>\n<\/div>\n<p>OligoSearchRequest\u3092\u53d7\u3051\u53d6\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/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;\nuse App\\Models\\Oligo;\nuse App\\Http\\Requests\\OligoSearchRequest;  \/\/ \u691c\u7d22\u30d5\u30a9\u30fc\u30e0\nuse App\\Services\\OligoService;  \/\/ \u691c\u7d22\u3092\u62c5\u3046\u30b5\u30fc\u30d3\u30b9\n \nclass OligoController\n{\n    \/* Laravel\u306eDI (Dependency Injection)\u306b\u3088\u3063\u3066OligoService\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u6e21\u3055\u308c\u308b\u3002\n     * private\u3068\u3059\u308b\u3053\u3068\u3067\u3001\u81ea\u52d5\u7684\u306b $this-&gt;service = $service \u304c\u884c\u308f\u308c\u308b\u3002\n     *\/\n    public function __construct(\n        private OligoService $service\n    ) {\n    }\n \n    public function index(){\n        $items = Oligo::all();\n        return view(&#039;oligo.index&#039;, compact(&#039;items&#039;))\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        Oligo::create($validated);\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    \/\/ \u691c\u7d22\n    public function search(OligoSearchRequest $request)\n    {\n        try{\n            $query = $request-&gt;validated();\n            $query[&#039;use_regex&#039;] = $query[&#039;use_regex&#039;] ?? false;  \/\/ \u305f\u3076\u3093OligoSearchRequest\u306e\u307b\u3046\u306b\u79fb\u52d5\u3057\u305f\u307b\u3046\u304c\u7f8e\u3057\u3044\n            return response()-&gt;json([\n                &#039;status&#039; =&gt; &#039;success&#039;,\n                &#039;data&#039; =&gt; $this-&gt;service-&gt;search($query),\n            ], 200);\n \n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n}\n<\/pre>\n<\/div>\n<h3>\u5165\u529b\u5024(Request)\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3<\/h3>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Http\/Requests\/OligoSearchRequest.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Http\\Requests;\n \nuse Illuminate\\Contracts\\Validation\\ValidationRule;\nuse Illuminate\\Foundation\\Http\\FormRequest;\n \nclass OligoSearchRequest extends FormRequest\n{\n    public function rules(): array\n    {\n        return [\n            &#039;name&#039; =&gt; &#039;nullable|string|max:255&#039;,\n            &#039;sequence&#039; =&gt; &#039;nullable|string|max:255&#039;,\n            &#039;box&#039; =&gt; &#039;nullable|string|max:255&#039;,\n            &#039;owner&#039; =&gt; &#039;nullable|string|max:255&#039;,\n            &#039;note&#039; =&gt; &#039;nullable|string|max:255&#039;,\n            &#039;updated_at&#039; =&gt; &#039;nullable|regex:\/^[0-9]*-?[0-9]*$\/&#039;,\n            &#039;created_at&#039; =&gt; &#039;nullable|regex:\/^[0-9]*-?[0-9]*$\/&#039;,\n            &#039;use_regex&#039; =&gt; &#039;nullable|boolean&#039;,\n        ];\n    }\n \n    public function messages(): array\n    {\n        return [\n            &#039;name.max&#039; =&gt; &#039;\u30b5\u30f3\u30d7\u30eb\u540d\u306f255\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&#039;,\n            &#039;sequence.max&#039; =&gt; &#039;\u5869\u57fa\u914d\u5217\u306f255\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&#039;,\n            &#039;box.max&#039; =&gt; &#039;\u5834\u6240\u306f255\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&#039;,\n            &#039;owner.max&#039; =&gt; &#039;\u6240\u6709\u8005\u306f255\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&#039;,\n            &#039;note.max&#039; =&gt; &#039;\u30e1\u30e2\u306f255\u6587\u5b57\u4ee5\u5185\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&#039;,\n            &#039;updated_at.regex&#039; =&gt; &#039;\u65e5\u4ed8\u306e\u66f8\u5f0f\u304c\u7570\u306a\u308a\u307e\u3059\u3002&#039;,\n            &#039;created_at.regex&#039; =&gt; &#039;\u65e5\u4ed8\u306e\u66f8\u5f0f\u304c\u7570\u306a\u308a\u307e\u3059\u3002&#039;,\n        ];\n    }\n \n    protected function prepareForValidation()\n    {\n        $this-&gt;merge([\n            &#039;use_regex&#039; =&gt; filter_var($this-&gt;use_regex, FILTER_VALIDATE_BOOLEAN),\n        ]);\n    }\n}\n<\/pre>\n<\/div>\n<h3>\u691c\u7d22\u30b5\u30fc\u30d3\u30b9\u3092\u3064\u304f\u308b<\/h3>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u3064\u304f\u308b\u306b\u306f\u30b3\u30fc\u30c9\u304c\u9577\u3059\u304e\u308b\u306e\u3067\u3001\u30b5\u30fc\u30d3\u30b9\u3092\u3064\u304f\u308b\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Services\/OligoService.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Services;\n \nuse App\\Models\\Oligo as Oligo;\nuse App\\Traits\\ParsesSearchQuery;\nuse App\\Traits\\ConvertsYmdDate;\n \nclass OligoService \n{\n    use ConvertsYmdDate;\n    use ParsesSearchQuery;\n \n    public function __construct(\n        protected Oligo $model\n    ) {\n    }\n \n    public function search(array $query){\n        $sql = $this-&gt;model-&gt;query()\n            -&gt;when(\n                $query[&#039;use_regex&#039;], \n                fn($q, $v) =&gt; $this-&gt;applyRegexCondition($q, &#039;name&#039;, $query[&#039;name&#039;] ?? &#039;&#039;)\n            )\n            -&gt;when(\n                ! $query[&#039;use_regex&#039;], \n                fn($q, $v) =&gt; $this-&gt;applyTokenCondition($q, &#039;name&#039;, $query[&#039;name&#039;] ?? &#039;&#039;)\n            );\n \n        foreach([&#039;sequence&#039;] as $field){\n            $sql-&gt;when(\n                $query[$field] ?? null, \n                fn($q, $v) =&gt; $q-&gt;where($field, &#039;ilike&#039;, &quot;%{$v}%&quot;)\n            );\n        }\n        foreach([&#039;box&#039;, &#039;owner&#039;, &#039;note&#039;] as $field){\n            $sql-&gt;when(\n                $query[$field] ?? null, \n                fn($q, $v) =&gt; $q-&gt;where($field, &#039;like&#039;, &quot;%{$v}%&quot;)\n            );\n        }\n        foreach([&#039;updated_at&#039;, &#039;created_at&#039;] as $field){\n            $sql-&gt;when(\n                $query[$field] ?? null, \n                fn($q, $v) =&gt; $this-&gt;applyDateCondition($q, $field, $v)\n            );\n        }\n        return [\n            &#039;items&#039; =&gt; $sql-&gt;orderBy(&#039;created_at&#039;, &#039;desc&#039;)-&gt;orderBy(&#039;id&#039;)-&gt;limit(201)-&gt;get(),\n            &#039;sql&#039; =&gt; $sql-&gt;toSql(), \n        ];\n    }\n}\n<\/pre>\n<\/div>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Traits\/ParsesSearchQuery.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Traits;\n \ntrait ParsesSearchQuery\n{\n    \/**\n     * \u7a7a\u767d\u3067\u5358\u8a9e\u3092\u533a\u5207\u3063\u3066\u3001like\u691c\u7d22\u3092\u3059\u308b\n     *\/\n    public function applyTokenCondition($sql, string $field, string $value)\n    {\n        $pattern = &#039;\/&quot;([^&quot;]*)&quot;|\\&#039;([^\\&#039;]*)\\&#039;|([^\\s]+)\/u&#039;;\n \n        if (preg_match_all($pattern, $value, $matches, PREG_SET_ORDER)) {\n            foreach ($matches as $m) {\n                $sql-&gt;when(\n                    $token = $m[1] ?? null, \n                    fn($q, $v) =&gt; $q-&gt;where($field, &#039;like&#039;, &quot;%{$token}%&quot;)\n                )-&gt;when(\n                    $token = $m[2] ?? null, \n                    fn($q, $v) =&gt; $q-&gt;where($field, &#039;like&#039;, &quot;%{$token}%&quot;)\n                )-&gt;when(\n                    $token = $m[3] ?? null, \n                    fn($q, $v) =&gt; $q-&gt;where($field, &#039;like&#039;, &quot;%{$token}%&quot;)\n                );\n            }\n        }\n \n        return $sql;\n    }\n \n    public function applyRegexCondition($sql, string $field, string $value)\n    {\n        return $sql-&gt;whereRaw(&quot;{$field} ~ ?&quot;, [$value]);\n    }\n    \n    public function applyDateCondition($sql, string $field, string $value)\n    {\n        if (!$value) return $sql;\n \n        \/\/ \u4f8b: &quot;210101-221231&quot;, &quot;210101-&quot;, &quot;-221231&quot;, &quot;210101&quot;\n        $parts = explode(&#039;-&#039;, $value);\n \n        \/\/ 210304\n        if (count($parts) === 1) {\n            return $sql-&gt;where($field, &#039;=&#039;, $this-&gt;ymdToDate($parts[0]));\n        }\n \n        [$start, $end] = $parts;\n \n        \/\/ 210304-\n        if ($start !== &#039;&#039;) {\n            $sql-&gt;where($field, &#039;&gt;=&#039;, $this-&gt;ymdToDate($start));\n        }\n \n        \/\/  -250607\n        if ($end !== &#039;&#039;) {\n            $sql-&gt;where($field, &#039;&lt;=&#039;, $this-&gt;ymdToDate($end));\n        }\n \n        return $sql;\n    }\n \n}\n<\/pre>\n<\/div>\n<h2>\u30c7\u30fc\u30bf\u767b\u9332<\/h2>\n<p>\u30c7\u30fc\u30bf\u767b\u9332\u306e\u30d5\u30a9\u30fc\u30e0\u3082\u66f4\u65b0\u3057\u307e\u3059\u3002\u30bf\u30d6\u533a\u5207\u308a\u30c6\u30ad\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b\u3088\u3046\u306b\u3057\u3066\u3001\u4e00\u5ea6\u306b\u305f\u304f\u3055\u3093\u306e\u30c7\u30fc\u30bf\u3092\u767b\u9332\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\n\u5fc5\u8981\u306a\u3082\u306e\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u767b\u9332\u7528\u306e\u30d5\u30a9\u30fc\u30e0 -&gt; create.blade.php\u306b\u3064\u304f\u308b\u3002<\/li>\n<li>\u65b0\u898f\u30c7\u30fc\u30bf\u306e\u9001\u4fe1 -&gt; Javascript\u306efetch\u3067\/oligo\/store\u306b\u9001\u4fe1\u3059\u308b\u3002<\/li>\n<li>\u30af\u30a8\u30ea\u306e\u53d7\u4fe1 -&gt; OligoController\u3092\u8907\u6570\u306e\u30c7\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308c\u308b\u3088\u3046\u306bOligosRequest\u306b\u5909\u66f4\u3002<\/li>\n<li>\u9001\u4fe1\u30c7\u30fc\u30bf\u306e\u691c\u8a3c -&gt; OligosRequest\u3067\u884c\u3046\u3002<\/li>\n<li>SQL\u306e\u5b9f\u884c -&gt; OligoService\u306b\u30e1\u30bd\u30c3\u30c9\u8ffd\u52a0\u3002<\/li>\n<li>\u691c\u7d22\u7d50\u679c\u306e\u9001\u4fe1 -&gt; JSON\u3067\u9001\u308b\u3002\u6210\u529f\u3057\u305f\u30c7\u30fc\u30bf\u3092create\u30d3\u30e5\u30fc\u304b\u3089\u524a\u9664\u3057\u3001items\u306b\u8ffd\u52a0\u3057\u3066index\u30d3\u30e5\u30fc\u3092\u66f4\u65b0\u3059\u308b\u3002<\/li>\n<\/ol>\n<h3>\u767b\u9332\u7528\u30d5\u30a9\u30fc\u30e0\u3092\u3064\u304f\u308b<\/h3>\n<p>\u5165\u529b\u7528\u30d5\u30a9\u30fc\u30e0\u3092 <code>resources\/views\/oligo\/create.blade.php<\/code> \u306b\u3064\u304f\u308b\u3002\n\u30bf\u30d6\u533a\u5207\u308a\u306e\u30c6\u30ad\u30b9\u30c8\u3092textarea\u306b\u5165\u529b\u3057\u3001\u3053\u308c\u3092\u5206\u5272\u3057\u3066\u30c6\u30fc\u30d6\u30eb\u578b\u306e\u30d5\u30a9\u30fc\u30e0\u306b\u57cb\u3081\u308b\u3088\u3046\u306b\u3059\u308b\u3002\n\u30c7\u30fc\u30bf\u306fJavascript\u3067\u9001\u4fe1\u3059\u308b\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/oligo\/create.blade.php<\/h5>\n<pre >\n@extends(&#039;oligo.module&#039;)\n \n@section(&#039;feature&#039;)\n&lt;x-feature id=&#039;oligo-create&#039;\n  x-data=&quot;{\n    fields: [&#039;name&#039;, &#039;sequence&#039;, &#039;created_at&#039;, &#039;owner&#039;],  \/\/ \u7a7a\u5224\u5b9a\u3092\u3059\u308b\u9805\u76ee\n    isRowEmpty(row) {\n      return this.fields.every(field =&gt; !row[field] || row[field] === &#039;&#039;);\n    },\n \n    id: 1,  \/\/ \u3053\u306eid\u306frows\u306e\u4e2d\u3067\u306e\u307f\u6709\u52b9\u3002template x-for\u3067\u30ad\u30fc\u304c\u3042\u3063\u305f\u307b\u3046\u304c\u4fbf\u5229\u306a\u306e\u3067\u3001\u91cd\u8907\u3057\u306a\u3044\u5024\u3092\u3064\u304f\u308b\u3002\n    rows:[],\n    addRow(row) {\n      if (this.rows.length &gt; 50) return; \/\/ \u30d0\u30b0\u306b\u3088\u3063\u3066\u884c\u6570\u304c\u5897\u3048\u3059\u304e\u306a\u3044\u305f\u3081\u306e\u5b89\u5168\u88c5\u7f6e\n      this.rows.push({...row, id: this.id++});\n    },\n    mode: &#039;paste&#039;,\n  }&quot;\n  x-init=&quot;\n    addRow({});  \/\/ \u6700\u521d\u306e\u884c\u3092\u8ffd\u52a0\n \n    \/\/ rows\u306e\u4e2d\u8eab\u3092\u76e3\u8996\u3059\u308b\n    $watch(&#039;rows&#039;, (_rows) =&gt; {\n      const hasEmpty = _rows.some(row =&gt; isRowEmpty(row));\n \n      \/\/ \u6700\u5f8c\u306e\u884c\u304c\u7a7a\u3067\u306a\u3044\u306a\u3089\u8ffd\u52a0\n      if (! hasEmpty) {\n        addRow({});\n      }\n    }, { deep: true }); \/* \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u5185\u90e8\u306e\u5909\u66f4\u3092\u691c\u77e5\u3059\u308b\u305f\u3081\u306b deep: true \u304c\u5fc5\u9808 *\/\n  &quot;\n&gt;\n  &lt;div class=&quot;flex gap-2 my-2&quot;&gt;\n    \u5165\u529b\u65b9\u6cd5 (\u73fe\u5728\u5024: &lt;span x-text=&quot;mode&quot;&gt;&lt;\/span&gt;)\n    &lt;input type=&#039;radio&#039; name=&#039;mode&#039; id=&#039;mode-paste&#039; value=&#039;paste&#039; checked x-model=&#039;mode&#039;&gt;&lt;label for=&#039;mode-paste&#039;&gt;\u8cbc\u308a\u4ed8\u3051&lt;\/label&gt;\n    &lt;input type=&#039;radio&#039; name=&#039;mode&#039; id=&#039;mode-form&#039;  value=&#039;form&#039; x-model=&#039;mode&#039;&gt;&lt;label for=&#039;mode-form&#039;&gt;\u30d5\u30a9\u30fc\u30e0&lt;\/label&gt;\n  &lt;\/div&gt;\n \n  {{-- \u30bf\u30d6\u307e\u305f\u306f\u30ab\u30f3\u30de\u533a\u5207\u308a\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u8cbc\u308a\u4ed8\u3051\u308b\u5834\u6240 --}}\n  &lt;div x-show=&quot;mode == &#039;paste&#039;&quot;\n    x-data=&quot;{\n      raw: &#039;&#039;,\n      parse() {\n        if (!this.raw.trim()) return;\n \n        const lines = this.raw.trim().split(&#039;\\n&#039;).map(l =&gt; l.split(\/[\\t,]\/));\n \n        \/\/ \u76f4\u63a5rows\u3092\u7de8\u96c6\u3057\u306a\u3044\u3067\u3001addRow\u3092\u4f7f\u3046\u3088\u3046\u306b\u3057\u305f\u307b\u3046\u304c\u3088\u3044\u304c\u3001\u4eca\u306e\u3068\u3053\u308d\u65b0\u3057\u3044\u5165\u529b\u306e\u305f\u3081\u306e\u7a7a\u884c\u3092\u6700\u5f8c\u306b\u3082\u3063\u3066\u304f\u308b\u65b9\u6cd5\u304c\u308f\u304b\u3089\u306a\u3044(\u8907\u96d1\u306b\u306a\u308b)\u306e\u3067\u3001\u3053\u306e\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u3002\n        rows = lines.map(cols =&gt; {\n          const row = {\n            id: this.id++,\n            name: cols[0],\n            sequence: cols[1],\n            created_at: &#039;260816&#039;  \/\/ 6\u6841\u306e\u5f53\u65e5\u306e\u6570\u5b57\u3092\u3064\u304f\u308b\u95a2\u6570\u306b\u7f6e\u304d\u63db\u3048\u308b\n          };\n \n          console.log(&#039;row:&#039;, row);\n          return row;\n        });\n \n        if(rows.length &gt; 0){\n          mode = &#039;form&#039;;  \/\/ \u30d5\u30a9\u30fc\u30e0\u8868\u793a\u306b\u5207\u308a\u66ff\u3048\u308b\n        }\n      }\n    }&quot;\n    x-init=&quot;\n      if(0){ \/\/ \u30c7\u30d0\u30c3\u30b0\u7528\u306b\u30c7\u30fc\u30bf\u3092\u5165\u529b\u3057\u305f\u72b6\u614b\u306b\u3059\u308b\n        raw = &#039;Oligo1\\tACTGG\\nOligo2\\tAGGCCCT&#039;;\n        parse();\n      }\n    &quot;\n  &gt;\n    &lt;p&gt;\u540d\u524d\u3068\u914d\u5217\u3092\u3001\u30bf\u30d6\u307e\u305f\u306f\u30ab\u30f3\u30de\u3067\u533a\u5207\u3063\u3066\u3001\u4e00\u884c\u306b\u4e00\u3064\u305a\u3064\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&lt;\/p&gt;\n    &lt;textarea class=&quot;border border-cyan-600 w-full min-w-0 my-2 p-1 h-[10rem] font-mono text-sm&quot;\n      placeholder=&quot;{{ &quot;name\\tsequence&quot; }}&quot;\n      x-model=&quot;raw&quot;\n      @change=&quot;parse()&quot;\n    &gt;&lt;\/textarea&gt;\n \n    &lt;button :disabled=&quot;!raw.trim()&quot;\n      @click.prevent=&quot;parse()&quot;\n    &gt;\n      \u8cbc\u308a\u4ed8\u3051\u305f\u30c7\u30fc\u30bf\u3092\u30d5\u30a9\u30fc\u30e0\u306b\u53cd\u6620\n    &lt;\/button&gt;\n  &lt;\/div&gt;\n \n  {{-- \u30d5\u30a9\u30fc\u30e0 --}}\n  &lt;div x-show=&quot;mode == &#039;form&#039;&quot;&gt;\n    &lt;table class=&#039;material-list border-cyan-600 border-b-2 border-t-2 w-full my-2&#039; \n      x-show=&quot;mode === &#039;form&#039;&quot;\n    &gt;\n      {{-- thead 1\u884c\u76ee \u898b\u51fa\u3057 --}}\n      &lt;thead&gt;\n        &lt;tr class=&#039;bg-cyan-400&#039;&gt;\n          &lt;th&gt;{{ __(&#039;\u540d\u524d&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u914d\u5217&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u4f5c\u6210\u65e5&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u4f5c\u6210\u8005&#039;) }}&lt;\/th&gt;\n        &lt;\/tr&gt;\n      &lt;\/thead&gt;\n \n      &lt;tbody&gt;\n        &lt;!-- \u5bfe\u8c61\u30b5\u30f3\u30d7\u30eb --&gt;\n        &lt;template x-for=&quot;row in rows&quot; :key=&quot;row.id&quot;&gt;\n          &lt;tr&gt;\n            &lt;td class=&#039;name&#039;&gt;\n              &lt;input x-model=&quot;row.name&quot; placeholder=&quot;\u540d\u524d&quot;&gt;\n            &lt;\/td&gt;\n            &lt;td class=&#039;sequence&#039;&gt;\n              &lt;input x-model=&quot;row.sequence&quot; placeholder=&quot;ATCG...&quot;&gt;\n            &lt;\/td&gt;\n            &lt;td class=&#039;date&#039;&gt;\n              &lt;input x-model=&quot;row.created_at&quot; placeholder=&quot;260101&quot;\n                title=&quot;6\u6841\u306e\u6570\u5b57\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002-\u3067\u7bc4\u56f2\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002&quot;\n              &gt;\n            &lt;\/td&gt;\n            &lt;td class=&#039;owner&#039;&gt;\n              &lt;input x-model=&quot;row.owner&quot; placeholder=&quot;\u4f5c\u6210\u8005&quot;&gt;\n            &lt;\/td&gt;\n          &lt;\/tr&gt;\n        &lt;\/template&gt;\n      &lt;\/tbody&gt;\n    &lt;\/table&gt;\n \n    &lt;button :disabled=&quot;rows.length &lt;= 1&quot;\n      @click.prevent=&quot;\n        fetch(&#039;{{ route(&#039;web.oligo.store&#039;) }}&#039;, {\n          method: &#039;POST&#039;,\n          headers: {\n            &#039;Content-Type&#039;: &#039;application\/json&#039;,\n            &#039;Accept&#039;: &#039;application\/json&#039;,\n            &#039;X-CSRF-TOKEN&#039;: &#039;{{ csrf_token() }}&#039;\n          },\n          body: JSON.stringify({\n            oligos: rows.filter(row =&gt; ! isRowEmpty(row))\n          })\n        })\n          .then(response =&gt; response.json())\n          .then(data =&gt; {\n            console.log(&#039;data:&#039;, data);\n            console.log(&#039;data.created:&#039;, data.created);\n            rows = [];\n            append(data.created);\n          });\n      &quot;\n    &gt;\n      \u8ffd\u52a0\n    &lt;\/button&gt;\n \n  &lt;\/div&gt;\n&lt;\/x-feature&gt;\n@endsection\n<\/pre>\n<\/div>\n<h3>\u65b0\u898f\u30c7\u30fc\u30bf\u306e\u53d7\u4fe1\u3068\u767b\u9332<\/h3>\n<p>OligoController\u306estore\u30e1\u30bd\u30c3\u30c9\u3067\u3001OligosRequest\u3092\u53d7\u3051\u53d6\u308b\u3088\u3046\u306b\u3059\u308b\u3002\n\u53d7\u3051\u53d6\u3063\u305f\u30c7\u30fc\u30bf\u306fOligoService\u3067\u30c6\u30fc\u30d6\u30eb\u306b\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<p><\/p>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Http\/Requests\/OligosRequest.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Http\\Requests;\n \nuse Illuminate\\Contracts\\Validation\\Validator;\nuse Illuminate\\Foundation\\Http\\FormRequest;\nuse Illuminate\\Http\\Exceptions\\HttpResponseException;\n \nclass OligosRequest extends FormRequest\n{\n    public function rules(): array\n    {\n        return [\n            &#039;oligos&#039; =&gt; [&#039;required&#039;, &#039;array&#039;],\n            &#039;oligos.*&#039; =&gt; [&#039;array&#039;],\n        ];\n    }\n \n    public function messages(): array\n    {\n        return [\n            &#039;oligos.required&#039; =&gt; &#039;\u5165\u529b\u5024\u304c\u3042\u308a\u307e\u305b\u3093\u3002&#039;,\n            &#039;oligos.array&#039; =&gt; &#039;\u9001\u4fe1\u3055\u308c\u305f\u30c7\u30fc\u30bf\u306f\u914d\u5217\u3067\u3042\u308a\u307e\u305b\u3093\u3002&#039;,\n        ];\n    }\n \n    public array $validOligos = [];\n    public array $invalidOligos = [];\n \n    protected function passedValidation()\n    {\n        $single = new OligoRequest();\n        $rules = $single-&gt;rules();\n        $messages = $single-&gt;messages();\n \n        foreach ($this-&gt;oligos as $index =&gt; $oligo) {\n            \/\/ OligoRequest \u3092\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u3066\u3001\u305d\u306e\u30eb\u30fc\u30eb\u3060\u3051\u501f\u7528\n            $validator = \\Validator::make($oligo, $rules, $messages);\n \n            if ($validator-&gt;fails()) {\n                $this-&gt;invalidOligos[$index] = [\n                    &#039;data&#039; =&gt; $oligo,\n                    &#039;errors&#039; =&gt; $validator-&gt;errors()-&gt;toArray(),\n                ];\n            } else {\n                $this-&gt;validOligos[] = $validator-&gt;validated();\n            }\n        }\n    }\n}\n<\/pre>\n<\/div>\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\\Models\\Oligo;\nuse App\\Services\\OligoService;\nuse App\\Http\\Requests\\OligoRequest;\nuse App\\Http\\Requests\\OligoSearchRequest;\nuse App\\Http\\Requests\\OligosRequest; \/\/ \u8907\u6570\u306e\u30c7\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308b\n \nclass OligoController\n{\n    \/* Laravel\u306eDI (Dependency Injection)\u306b\u3088\u3063\u3066OligoService\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u6e21\u3055\u308c\u308b\u3002\n     * private\u3068\u3059\u308b\u3053\u3068\u3067\u3001\u81ea\u52d5\u7684\u306b $this-&gt;service = $service \u304c\u884c\u308f\u308c\u308b\u3002\n     *\/\n    public function __construct(\n        private OligoService $service\n    ) {\n    }\n \n    public function index(){\n        $items = Oligo::all();\n        return view(&#039;oligo.index&#039;, compact(&#039;items&#039;))\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        -&gt;fragmentIf(request()-&gt;hasHeader(&#039;HX-Request&#039;), &quot;feature-oligo-create&quot;)\n        ;\n    }\n \n    public function store(OligosRequest $request){\n        try{\n            $oligos = $request-&gt;validOligos;\n            $data = $this-&gt;service-&gt;create($oligos);\n \n            return response()-&gt;json(array_merge($data, [\n                &#039;status&#039; =&gt; &#039;success&#039;, \n                &#039;input&#039; =&gt; $oligos,\n            ]), 200);\n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n \n    \/\/ \u691c\u7d22\n    public function search(OligoSearchRequest $request)\n    {\n        try{\n            $query = $request-&gt;validated();\n            $query[&#039;use_regex&#039;] = $query[&#039;use_regex&#039;] ?? false;  \/\/ \u305f\u3076\u3093OligoSearchRequest\u306e\u307b\u3046\u306b\u79fb\u52d5\u3057\u305f\u307b\u3046\u304c\u7f8e\u3057\u3044\n            return response()-&gt;json([\n                &#039;status&#039; =&gt; &#039;success&#039;,\n                &#039;data&#039; =&gt; $this-&gt;service-&gt;search($query),\n            ], 200);\n \n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n}\n<\/pre>\n<\/div>\n<div class='code'>\n  <h5 class=\"source-file\">app\/Services\/OligoService.php<\/h5>\n<pre >\n&lt;?php\n \nnamespace App\\Services;\n \nuse App\\Models\\Oligo as Oligo;\nuse App\\Traits\\ParsesSearchQuery;\nuse App\\Traits\\ConvertsYmdDate;\n \nclass OligoService \n{\n    use ConvertsYmdDate;\n    use ParsesSearchQuery;\n \n    public function __construct(\n        protected Oligo $model\n    ) {\n    }\n \n    public function search(array $query){\n        $sql = $this-&gt;model-&gt;query()\n            -&gt;when(\n                $query[&#039;use_regex&#039;], \n                fn($q, $v) =&gt; $this-&gt;applyRegexCondition($q, &#039;name&#039;, $query[&#039;name&#039;] ?? &#039;&#039;)\n            )\n            -&gt;when(\n                ! $query[&#039;use_regex&#039;], \n                fn($q, $v) =&gt; $this-&gt;applyTokenCondition($q, &#039;name&#039;, $query[&#039;name&#039;] ?? &#039;&#039;)\n            );\n \n        foreach([&#039;sequence&#039;] as $field){\n            $sql-&gt;when(\n                $query[$field] ?? null, \n                fn($q, $v) =&gt; $q-&gt;where($field, &#039;ilike&#039;, &quot;%{$v}%&quot;)\n            );\n        }\n        foreach([&#039;box&#039;, &#039;owner&#039;, &#039;note&#039;] as $field){\n            $sql-&gt;when(\n                $query[$field] ?? null, \n                fn($q, $v) =&gt; $q-&gt;where($field, &#039;like&#039;, &quot;%{$v}%&quot;)\n            );\n        }\n        foreach([&#039;updated_at&#039;, &#039;created_at&#039;] as $field){\n            $sql-&gt;when(\n                $query[$field] ?? null, \n                fn($q, $v) =&gt; $this-&gt;applyDateCondition($q, $field, $v)\n            );\n        }\n        return [\n            &#039;items&#039; =&gt; $sql-&gt;orderBy(&#039;created_at&#039;, &#039;desc&#039;)-&gt;orderBy(&#039;id&#039;)-&gt;limit(201)-&gt;get(),\n            &#039;sql&#039; =&gt; $sql-&gt;toSql(), \n        ];\n    }\n \n    public function create(array $items)\n    {\n        $results = [\n            &#039;created&#039; =&gt; [], \n            &#039;succeeded&#039; =&gt; [],\n            &#039;failed&#039; =&gt; [], \n        ];\n \n        foreach($items as $index =&gt; $item){\n            try{\n                $created = $this-&gt;model-&gt;create($item);\n                $results[&#039;created&#039;][] = $created;\n                $results[&#039;succeeded&#039;][$index] = $created;\n            }catch(\\Throwable $e){\n                $results[&#039;failed&#039;][$index] = array_merge($item, [&#039;error&#039; =&gt; $e-&gt;getMessage()]);\n            }\n        }\n        return $results;\n    }\n}\n<\/pre>\n<\/div>\n<h2>\u30c7\u30fc\u30bf\u4fee\u6b63<\/h2>\n<p>\u30c7\u30fc\u30bf\u306e\u4fee\u6b63\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\n\u691c\u7d22\u3067\u4fee\u6b63\u3057\u305f\u3044\u3082\u306e\u3092\u63a2\u3057\u3001\u30c1\u30a7\u30c3\u30af\u3092\u3044\u308c\u305f\u3082\u306e\u306b\u3064\u3044\u3066\u3001\u4fee\u6b63\u30d5\u30a9\u30fc\u30e0\u3092\u3064\u304f\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\n\u5fc5\u8981\u306a\u3082\u306e\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u4fee\u6b63\u5bfe\u8c61\u306e\u9078\u629e -&gt; oligo\/module.blade.php\u306ex-data\u306bget checked\u3092\u8ffd\u52a0\u3002<\/li>\n<li>\u30d5\u30a9\u30fc\u30e0\u3092\u53d6\u5f97\u3059\u308bedit\u3001\u66f4\u65b0\u3059\u308bupdate \u30eb\u30fc\u30c8\u306e\u4f5c\u6210 -&gt; web.php\u3068OligoController<\/li>\n<li>\u30d5\u30a9\u30fc\u30e0\u306e\u4f5c\u6210 -&gt; oligo\/edit.blade.php<\/li>\n<li>\u30c7\u30fc\u30bf\u691c\u8a3c\u306f\u65e2\u5b58\u306eOligoRequest\u3001\u30c7\u30fc\u30bf\u66f4\u65b0\u306f \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067$model-&gt;update<\/li>\n<li>\u66f4\u65b0\u306b\u5931\u6557\u3057\u305f\u3082\u306e\u3092\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u306e\u306f\u5f8c\u56de\u3057\u3002<\/li>\n<\/ol>\n<h3>\u4fee\u6b63\u7528\u30d5\u30a9\u30fc\u30e0\u3092\u3064\u304f\u308b<\/h3>\n<p><code>resources\/views\/oligo\/module.blade.php<\/code> \u3092\u4fee\u6b63\u3057\u3066\u3001\u30c1\u30a7\u30c3\u30af\u306e\u5165\u3063\u305f\u3082\u306e\u3060\u3051\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\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          &#039;edit&#039; =&gt; &#039;\u7de8\u96c6&#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              @click.prevent=&quot;selectTab(event)&quot;\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;div class=&#039;features&#039;\n      {{-- oligo\u30e2\u30b8\u30e5\u30fc\u30eb\u5168\u4f53\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3053\u3053\u306bx-data\u3092\u5b9a\u7fa9\u3059\u308b --}}\n      x-data=&quot;{\n        items: [], \/\/ \u30c6\u30fc\u30d6\u30eb\u304b\u3089\u62bd\u51fa\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3002\u4eca\u5f8c\u66f4\u65b0\u3084\u524a\u9664\u306e\u6a5f\u80fd\u3067\u3082\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u3053\u3053(#features)\u306b\u5b9a\u7fa9\u3059\u308b\u3002\n        query: {}, \/\/ \u691c\u7d22\u306e\u6761\u4ef6\u3002x-model\u3068\u3057\u3066\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u306e\u5024\u304c\u305d\u306e\u307e\u307eJavascript\u3067\u4f7f\u7528\u3067\u304d\u308b\n \n        \/\/ \u691c\u7d22 fetch\u306f\u975e\u540c\u671f(async)\u306b\u5b9f\u884c\u3055\u308c\u308b\u306e\u3067\u3001\u305d\u308c\u306b\u305d\u308d\u3048\u308b\n        async search(){\n          const parameter = new URLSearchParams(this.query);  \/\/ \u540c\u3058x-data\u5185\u306a\u306e\u3067 this.query\u3068\u306a\u308b\u3002\u3053\u308c\u3092GET\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc(?key1=value1&amp;key2=value2)\u306b\u5909\u63db\u3059\u308b\n          console.log(&#039;parameter:&#039;, parameter.toString());  \/\/ \u52d5\u4f5c\u78ba\u8a8d\n          const options = {\n            method: &#039;GET&#039;,\n            headers: {\n              &#039;Accept&#039;: &#039;application\/json&#039;,  \/\/ \u8fd4\u308a\u5024\u306e\u8a2d\u5b9a\u3002Laravel\u304c\u5224\u65ad\u3059\u308b\u306e\u306b\u4f7f\u3046\u3002\n              &#039;Content-Type&#039;: &#039;application\/json&#039;,\n            },\n          };\n \n          return fetch(&#039;{{ route(&#039;web.oligo.search&#039;) }}?&#039; + parameter.toString(), options)\n            .then(response =&gt; response.json())\n            .then(response =&gt; {\n              console.log(&#039;search done&#039;, response);  \/\/ \u52d5\u4f5c\u78ba\u8a8d\n              return this.append(response.data.items);  \/\/ items\u3092\u7f6e\u304d\u63db\u3048\u308bappend\u3092\u547c\u3076\n            })\n            .catch(error =&gt; {debug(error)})\n          ;\n        },\n \n        \/\/ \u691c\u7d22\u7d50\u679c\u3092items\u306b\u53cd\u6620\u3055\u305b\u308b\u3002\u4eca\u5f8c\u3001\u65b0\u3057\u3044\u691c\u7d22\u7d50\u679c\u3067\u7f6e\u304d\u63db\u3048\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u8ffd\u52a0\u3059\u308b\u3088\u3046\u306b\u4fee\u6b63\u3057\u3066\u3044\u304f\u306e\u3067\u3001append\u3068\u3057\u3066\u3042\u308b\u3002\n        append(items){\n          console.log(&#039;append:&#039;, items);\n          this.items = items;\n        },\n \n        \/\/ \u30c1\u30a7\u30c3\u30af\u304c\u3044\u308c\u3089\u308c\u305f\u3082\u306e\u3060\u3051\u3092\u53d6\u5f97\u3059\u308b\u3002\n        get checked(){\n          return this.items.filter(item =&gt; item.checked);\n        },\n        get hasChecked(){\n          return this.checked.length &gt; 0;\n        }\n      }&quot;\n    &gt;\n      @yield(&#039;feature&#039;)\n    &lt;\/div&gt;\n  &lt;\/x-module&gt;\n@endsection\n<\/pre>\n<\/div>\n<p><code>resources\/views\/oligo\/edit.blade.php<\/code> \u306b\u4fee\u6b63\u30d5\u30a9\u30fc\u30e0\u3092\u3064\u304f\u308b\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/oligo\/edit.blade.php<\/h5>\n<pre >\n@extends(&#039;oligo.module&#039;)\n \n@section(&#039;feature&#039;)\n&lt;x-feature id=&#039;oligo-edit&#039;&gt;\n \n  &lt;p x-show=&quot;!hasChecked&quot; class=&quot;pb-10 pl-4&quot;&gt;\n    &lt;a\n      href=&quot;{{ route(&#039;web.oligo.index&#039;) }}&quot;\n      id=&quot;oligo-edit-abc&quot;\n      @click.prevent=&quot;selectTab(event)&quot; \/\/ \u3053\u308c\u304c\u52d5\u4f5c\u3057\u306a\u3044\u3002\u5f8c\u3067\u8003\u3048\u308b\u3002\n    &gt;\n      \u5148\u306b\u7de8\u96c6\u5bfe\u8c61\u306e\u30b5\u30f3\u30d7\u30eb\u306b\u30c1\u30a7\u30c3\u30af\u3092\u3044\u308c\u3066\u304f\u3060\u3055\u3044\u3002\n    &lt;\/a&gt;\n  &lt;\/p&gt;\n \n  &lt;table class=&#039;material-list border-cyan-600 border-b-2 border-t-2 w-full my-2&#039;\n    x-show=&quot;hasChecked&quot;\n  &gt;\n    &lt;thead&gt;\n        &lt;tr class=&#039;bg-cyan-400&#039;&gt;\n          &lt;th&gt;&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u540d\u524d&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u914d\u5217&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u4f5c\u6210\u65e5&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u4f5c\u6210\u8005&#039;) }}&lt;\/th&gt;\n        &lt;\/tr&gt;\n    &lt;\/thead&gt;\n \n    &lt;tbody&gt;\n      &lt;!-- \u691c\u7d22\u7d50\u679c --&gt;\n      &lt;template x-for=&quot;item in checked&quot; :key=&quot;item.id&quot;&gt;\n        &lt;tr\n          @input.debounce.500=&quot;\n            item.status = &#039;loading&#039;;\n            try{\n              fetch(\n                url = `{{ route(&#039;web.oligo.index&#039;) }}\/${item.id}`,\n                {\n                  method: &#039;PUT&#039;,\n                  headers: {\n                    &#039;Content-Type&#039;: &#039;application\/json&#039;,\n                    &#039;Accept&#039;: &#039;application\/json&#039;,\n                    &#039;X-CSRF-TOKEN&#039;: &#039;{{ csrf_token() }}&#039;,\n                  },\n                  body: JSON.stringify(item)\n                }\n              )\n              .then(response =&gt; response.json())\n              .then(data =&gt; {\n                console.log(&#039;data:&#039;, data);\n                item.status = data.status;\n              });\n            }catch(e){\n              item.status = &#039;error&#039;;\n            }\n            setTimeout(() =&gt; item.status = null, 2000);\n          &quot;\n        &gt;\n          &lt;td class=&quot;status-cell min-w-10&quot;&gt;\n            &lt;x-ajax-state var=&#039;item&#039; \/&gt;\n          &lt;\/td&gt;\n \n          &lt;td class=&#039;name&#039;&gt;\n            &lt;input x-model=&quot;item.name&quot; placeholder=&quot;\u540d\u524d&quot;&gt;\n          &lt;\/td&gt;\n          &lt;td class=&#039;sequence&#039;&gt;\n            &lt;input x-model=&quot;item.sequence&quot; placeholder=&quot;ATCG...&quot;&gt;\n          &lt;\/td&gt;\n          &lt;td class=&#039;date&#039;&gt;\n            &lt;input x-model=&quot;item.created_at&quot; placeholder=&quot;260101&quot;\n              title=&quot;6\u6841\u306e\u6570\u5b57\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002-\u3067\u7bc4\u56f2\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002&quot;\n            &gt;\n          &lt;\/td&gt;\n          &lt;td class=&#039;owner&#039;&gt;\n            &lt;input x-model=&quot;item.owner&quot; placeholder=&quot;\u4f5c\u6210\u8005&quot;&gt;\n          &lt;\/td&gt;\n        &lt;\/tr&gt;\n      &lt;\/template&gt;\n    &lt;\/tbody&gt;\n  &lt;\/table&gt;\n&lt;\/x-feature&gt;\n@endsection\n<\/pre>\n<\/div>\n<h3>\u65b0\u898f\u30c7\u30fc\u30bf\u306e\u53d7\u4fe1\u3068\u767b\u9332<\/h3>\n<p>edit \u3068 update \u306e\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b\u3002<\/p>\n<div class='code'>\n  <h5 class=\"source-file\">routes\/web.php<\/h5>\n<pre >\n&lt;?php\n \nuse Illuminate\\Support\\Facades\\Route;\nuse App\\Http\\Controllers\\OligoController;\n \nRoute::get(&#039;\/&#039;, function () {\n    return view(&#039;index&#039;);\n});\n \n\/*\n *\t\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u7d4c\u7531\u3059\u308b\u30eb\u30fc\u30c8\n *\/\nRoute::prefix(&#039;\/oligo&#039;)-&gt;as(&#039;web.oligo.&#039;)-&gt;group(function (){\n    Route::get(&#039;\/&#039;, [OligoController::class, &#039;index&#039;])-&gt;name(&#039;index&#039;);\n    Route::get(&#039;\/search&#039;, [OligoController::class, &#039;search&#039;])-&gt;name(&#039;search&#039;);\n    Route::get(&#039;\/create&#039;, [OligoController::class, &#039;create&#039;])-&gt;name(&#039;create&#039;);\n    Route::post(&#039;\/&#039;, [OligoController::class, &#039;store&#039;])-&gt;name(&#039;store&#039;);\n \n    \/\/ \u7de8\u96c6\u30d5\u30a9\u30fc\u30e0\u3068\u30c7\u30fc\u30bf\u66f4\u65b0\n    Route::get(&#039;\/edit&#039;, [OligoController::class, &#039;edit&#039;])-&gt;name(&#039;edit&#039;);\n    Route::put(&#039;\/{item}&#039;, [OligoController::class, &#039;update&#039;])-&gt;name(&#039;update&#039;);\n});\n<\/pre>\n<\/div>\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\\Models\\Oligo;\nuse App\\Services\\OligoService;\nuse App\\Http\\Requests\\OligoRequest;\nuse App\\Http\\Requests\\OligoSearchRequest;\nuse App\\Http\\Requests\\OligosRequest; \/\/ \u8907\u6570\u306e\u30c7\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308b\n \nclass OligoController\n{\n    \/* Laravel\u306eDI (Dependency Injection)\u306b\u3088\u3063\u3066OligoService\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u6e21\u3055\u308c\u308b\u3002\n     * private\u3068\u3059\u308b\u3053\u3068\u3067\u3001\u81ea\u52d5\u7684\u306b $this-&gt;service = $service \u304c\u884c\u308f\u308c\u308b\u3002\n     *\/\n    public function __construct(\n        private OligoService $service\n    ) {\n    }\n \n    public function index(){\n        $items = Oligo::all();\n        return view(&#039;oligo.index&#039;, compact(&#039;items&#039;))\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        -&gt;fragmentIf(request()-&gt;hasHeader(&#039;HX-Request&#039;), &quot;feature-oligo-create&quot;)\n        ;\n    }\n \n    public function store(OligosRequest $request){\n        try{\n            $oligos = $request-&gt;validOligos;\n            $data = $this-&gt;service-&gt;create($oligos);\n \n            return response()-&gt;json(array_merge($data, [\n                &#039;status&#039; =&gt; &#039;success&#039;, \n                &#039;input&#039; =&gt; $oligos,\n            ]), 200);\n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n \n    \/\/ \u691c\u7d22\n    public function search(OligoSearchRequest $request)\n    {\n        try{\n            $query = $request-&gt;validated();\n            $query[&#039;use_regex&#039;] = $query[&#039;use_regex&#039;] ?? false;  \/\/ \u305f\u3076\u3093OligoSearchRequest\u306e\u307b\u3046\u306b\u79fb\u52d5\u3057\u305f\u307b\u3046\u304c\u7f8e\u3057\u3044\n            return response()-&gt;json([\n                &#039;status&#039; =&gt; &#039;success&#039;,\n                &#039;data&#039; =&gt; $this-&gt;service-&gt;search($query),\n            ], 200);\n \n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n \n    public function edit(){\n        return view(&#039;oligo.edit&#039;)\n        -&gt;fragmentIf(request()-&gt;hasHeader(&#039;HX-Request&#039;), &quot;feature-oligo-edit&quot;)\n        ;\n    }\n \n    public function update(OligoRequest $request, Oligo $item){\n        try{\n            $item-&gt;update($request-&gt;validated());\n \n            return response()-&gt;json([\n                &#039;status&#039; =&gt; &#039;success&#039;, \n                &#039;item&#039; =&gt; $item,\n            ], 200);\n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n}\n<\/pre>\n<\/div>\n<!--\n## \u30c7\u30fc\u30bf\u524a\u9664\n\n\u66f4\u65b0\u306b\u30dc\u30bf\u30f3\u3092\u3064\u3051\u3066\u304a\u3057\u307e\u3044\u306b\u3059\u308b\u3002\n\n\u30c7\u30fc\u30bf\u306e\u524a\u9664\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002\n\n1. \u4fee\u6b63\u5bfe\u8c61\u306e\u9078\u629e -> oligo\/module.blade.php\u306ex-data\u306bget checked\u3092\u8ffd\u52a0\u3002\n3. \u30d5\u30a9\u30fc\u30e0\u3092\u53d6\u5f97\u3059\u308bedit\u3001\u66f4\u65b0\u3059\u308bupdate \u30eb\u30fc\u30c8\u306e\u4f5c\u6210 -> web.php\u3068OligoController\n5. \u30d5\u30a9\u30fc\u30e0\u306e\u4f5c\u6210 -> oligo\/edit.blade.php\n7. \u30c7\u30fc\u30bf\u691c\u8a3c\u306f\u65e2\u5b58\u306eOligoRequest\u3001\u30c7\u30fc\u30bf\u66f4\u65b0\u306f \u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067$model->update\n9. \u66f4\u65b0\u306b\u5931\u6557\u3057\u305f\u3082\u306e\u3092\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3059\u308b\u306e\u306f\u5f8c\u56de\u3057\u3002\n\n### \u4fee\u6b63\u7528\u30d5\u30a9\u30fc\u30e0\u3092\u3064\u304f\u308b\n\n`resources\/views\/oligo\/module.blade.php` \u3092\u4fee\u6b63\u3057\u3066\u3001\u30c1\u30a7\u30c3\u30af\u306e\u5165\u3063\u305f\u3082\u306e\u3060\u3051\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002\n\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          &#039;edit&#039; =&gt; &#039;\u7de8\u96c6&#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              @click.prevent=&quot;selectTab(event)&quot;\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;div class=&#039;features&#039;\n      {{-- oligo\u30e2\u30b8\u30e5\u30fc\u30eb\u5168\u4f53\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3053\u3053\u306bx-data\u3092\u5b9a\u7fa9\u3059\u308b --}}\n      x-data=&quot;{\n        items: [], \/\/ \u30c6\u30fc\u30d6\u30eb\u304b\u3089\u62bd\u51fa\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3002\u4eca\u5f8c\u66f4\u65b0\u3084\u524a\u9664\u306e\u6a5f\u80fd\u3067\u3082\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u3053\u3053(#features)\u306b\u5b9a\u7fa9\u3059\u308b\u3002\n        query: {}, \/\/ \u691c\u7d22\u306e\u6761\u4ef6\u3002x-model\u3068\u3057\u3066\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u306e\u5024\u304c\u305d\u306e\u307e\u307eJavascript\u3067\u4f7f\u7528\u3067\u304d\u308b\n \n        \/\/ \u691c\u7d22 fetch\u306f\u975e\u540c\u671f(async)\u306b\u5b9f\u884c\u3055\u308c\u308b\u306e\u3067\u3001\u305d\u308c\u306b\u305d\u308d\u3048\u308b\n        async search(){\n          const parameter = new URLSearchParams(this.query);  \/\/ \u540c\u3058x-data\u5185\u306a\u306e\u3067 this.query\u3068\u306a\u308b\u3002\u3053\u308c\u3092GET\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc(?key1=value1&amp;key2=value2)\u306b\u5909\u63db\u3059\u308b\n          console.log(&#039;parameter:&#039;, parameter.toString());  \/\/ \u52d5\u4f5c\u78ba\u8a8d\n          const options = {\n            method: &#039;GET&#039;,\n            headers: {\n              &#039;Accept&#039;: &#039;application\/json&#039;,  \/\/ \u8fd4\u308a\u5024\u306e\u8a2d\u5b9a\u3002Laravel\u304c\u5224\u65ad\u3059\u308b\u306e\u306b\u4f7f\u3046\u3002\n              &#039;Content-Type&#039;: &#039;application\/json&#039;,\n            },\n          };\n \n          return fetch(&#039;{{ route(&#039;web.oligo.search&#039;) }}?&#039; + parameter.toString(), options)\n            .then(response =&gt; response.json())\n            .then(response =&gt; {\n              console.log(&#039;search done&#039;, response);  \/\/ \u52d5\u4f5c\u78ba\u8a8d\n              return this.append(response.data.items);  \/\/ items\u3092\u7f6e\u304d\u63db\u3048\u308bappend\u3092\u547c\u3076\n            })\n            .catch(error =&gt; {debug(error)})\n          ;\n        },\n \n        \/\/ \u691c\u7d22\u7d50\u679c\u3092items\u306b\u53cd\u6620\u3055\u305b\u308b\u3002\u4eca\u5f8c\u3001\u65b0\u3057\u3044\u691c\u7d22\u7d50\u679c\u3067\u7f6e\u304d\u63db\u3048\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u8ffd\u52a0\u3059\u308b\u3088\u3046\u306b\u4fee\u6b63\u3057\u3066\u3044\u304f\u306e\u3067\u3001append\u3068\u3057\u3066\u3042\u308b\u3002\n        append(items){\n          console.log(&#039;append:&#039;, items);\n          this.items = items;\n        },\n \n        \/\/ \u30c1\u30a7\u30c3\u30af\u304c\u3044\u308c\u3089\u308c\u305f\u3082\u306e\u3060\u3051\u3092\u53d6\u5f97\u3059\u308b\u3002\n        get checked(){\n          return this.items.filter(item =&gt; item.checked);\n        },\n        get hasChecked(){\n          return this.checked.length &gt; 0;\n        }\n      }&quot;\n    &gt;\n      @yield(&#039;feature&#039;)\n    &lt;\/div&gt;\n  &lt;\/x-module&gt;\n@endsection\n<\/pre>\n<\/div>\n\n`resources\/views\/oligo\/edit.blade.php` \u306b\u4fee\u6b63\u30d5\u30a9\u30fc\u30e0\u3092\u3064\u304f\u308b\u3002\n\n<div class='code'>\n  <h5 class=\"source-file\">resources\/views\/oligo\/edit.blade.php<\/h5>\n<pre >\n@extends(&#039;oligo.module&#039;)\n \n@section(&#039;feature&#039;)\n&lt;x-feature id=&#039;oligo-edit&#039;&gt;\n \n  &lt;p x-show=&quot;!hasChecked&quot; class=&quot;pb-10 pl-4&quot;&gt;\n    &lt;a\n      href=&quot;{{ route(&#039;web.oligo.index&#039;) }}&quot;\n      id=&quot;oligo-edit-abc&quot;\n      @click.prevent=&quot;selectTab(event)&quot; \/\/ \u3053\u308c\u304c\u52d5\u4f5c\u3057\u306a\u3044\u3002\u5f8c\u3067\u8003\u3048\u308b\u3002\n    &gt;\n      \u5148\u306b\u7de8\u96c6\u5bfe\u8c61\u306e\u30b5\u30f3\u30d7\u30eb\u306b\u30c1\u30a7\u30c3\u30af\u3092\u3044\u308c\u3066\u304f\u3060\u3055\u3044\u3002\n    &lt;\/a&gt;\n  &lt;\/p&gt;\n \n  &lt;table class=&#039;material-list border-cyan-600 border-b-2 border-t-2 w-full my-2&#039;\n    x-show=&quot;hasChecked&quot;\n  &gt;\n    &lt;thead&gt;\n        &lt;tr class=&#039;bg-cyan-400&#039;&gt;\n          &lt;th&gt;&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u540d\u524d&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u914d\u5217&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u4f5c\u6210\u65e5&#039;) }}&lt;\/th&gt;\n          &lt;th&gt;{{ __(&#039;\u4f5c\u6210\u8005&#039;) }}&lt;\/th&gt;\n        &lt;\/tr&gt;\n    &lt;\/thead&gt;\n \n    &lt;tbody&gt;\n      &lt;!-- \u691c\u7d22\u7d50\u679c --&gt;\n      &lt;template x-for=&quot;item in checked&quot; :key=&quot;item.id&quot;&gt;\n        &lt;tr\n          @input.debounce.500=&quot;\n            item.status = &#039;loading&#039;;\n            try{\n              fetch(\n                url = `{{ route(&#039;web.oligo.index&#039;) }}\/${item.id}`,\n                {\n                  method: &#039;PUT&#039;,\n                  headers: {\n                    &#039;Content-Type&#039;: &#039;application\/json&#039;,\n                    &#039;Accept&#039;: &#039;application\/json&#039;,\n                    &#039;X-CSRF-TOKEN&#039;: &#039;{{ csrf_token() }}&#039;,\n                  },\n                  body: JSON.stringify(item)\n                }\n              )\n              .then(response =&gt; response.json())\n              .then(data =&gt; {\n                console.log(&#039;data:&#039;, data);\n                item.status = data.status;\n              });\n            }catch(e){\n              item.status = &#039;error&#039;;\n            }\n            setTimeout(() =&gt; item.status = null, 2000);\n          &quot;\n        &gt;\n          &lt;td class=&quot;status-cell min-w-10&quot;&gt;\n            &lt;x-ajax-state var=&#039;item&#039; \/&gt;\n          &lt;\/td&gt;\n \n          &lt;td class=&#039;name&#039;&gt;\n            &lt;input x-model=&quot;item.name&quot; placeholder=&quot;\u540d\u524d&quot;&gt;\n          &lt;\/td&gt;\n          &lt;td class=&#039;sequence&#039;&gt;\n            &lt;input x-model=&quot;item.sequence&quot; placeholder=&quot;ATCG...&quot;&gt;\n          &lt;\/td&gt;\n          &lt;td class=&#039;date&#039;&gt;\n            &lt;input x-model=&quot;item.created_at&quot; placeholder=&quot;260101&quot;\n              title=&quot;6\u6841\u306e\u6570\u5b57\u3067\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002-\u3067\u7bc4\u56f2\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002&quot;\n            &gt;\n          &lt;\/td&gt;\n          &lt;td class=&#039;owner&#039;&gt;\n            &lt;input x-model=&quot;item.owner&quot; placeholder=&quot;\u4f5c\u6210\u8005&quot;&gt;\n          &lt;\/td&gt;\n        &lt;\/tr&gt;\n      &lt;\/template&gt;\n    &lt;\/tbody&gt;\n  &lt;\/table&gt;\n&lt;\/x-feature&gt;\n@endsection\n<\/pre>\n<\/div>\n\n### \u65b0\u898f\u30c7\u30fc\u30bf\u306e\u53d7\u4fe1\u3068\u767b\u9332\n\nedit \u3068 update \u306e\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b\u3002\n\n<div class='code'>\n  <h5 class=\"source-file\">routes\/web.php<\/h5>\n<pre >\n&lt;?php\n \nuse Illuminate\\Support\\Facades\\Route;\nuse App\\Http\\Controllers\\OligoController;\n \nRoute::get(&#039;\/&#039;, function () {\n    return view(&#039;index&#039;);\n});\n \n\/*\n *\t\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u7d4c\u7531\u3059\u308b\u30eb\u30fc\u30c8\n *\/\nRoute::prefix(&#039;\/oligo&#039;)-&gt;as(&#039;web.oligo.&#039;)-&gt;group(function (){\n    Route::get(&#039;\/&#039;, [OligoController::class, &#039;index&#039;])-&gt;name(&#039;index&#039;);\n    Route::get(&#039;\/search&#039;, [OligoController::class, &#039;search&#039;])-&gt;name(&#039;search&#039;);\n    Route::get(&#039;\/create&#039;, [OligoController::class, &#039;create&#039;])-&gt;name(&#039;create&#039;);\n    Route::post(&#039;\/&#039;, [OligoController::class, &#039;store&#039;])-&gt;name(&#039;store&#039;);\n \n    \/\/ \u7de8\u96c6\u30d5\u30a9\u30fc\u30e0\u3068\u30c7\u30fc\u30bf\u66f4\u65b0\n    Route::get(&#039;\/edit&#039;, [OligoController::class, &#039;edit&#039;])-&gt;name(&#039;edit&#039;);\n    Route::put(&#039;\/{item}&#039;, [OligoController::class, &#039;update&#039;])-&gt;name(&#039;update&#039;);\n});\n<\/pre>\n<\/div>\n\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\\Models\\Oligo;\nuse App\\Services\\OligoService;\nuse App\\Http\\Requests\\OligoRequest;\nuse App\\Http\\Requests\\OligoSearchRequest;\nuse App\\Http\\Requests\\OligosRequest; \/\/ \u8907\u6570\u306e\u30c7\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u308b\n \nclass OligoController\n{\n    \/* Laravel\u306eDI (Dependency Injection)\u306b\u3088\u3063\u3066OligoService\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u6e21\u3055\u308c\u308b\u3002\n     * private\u3068\u3059\u308b\u3053\u3068\u3067\u3001\u81ea\u52d5\u7684\u306b $this-&gt;service = $service \u304c\u884c\u308f\u308c\u308b\u3002\n     *\/\n    public function __construct(\n        private OligoService $service\n    ) {\n    }\n \n    public function index(){\n        $items = Oligo::all();\n        return view(&#039;oligo.index&#039;, compact(&#039;items&#039;))\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        -&gt;fragmentIf(request()-&gt;hasHeader(&#039;HX-Request&#039;), &quot;feature-oligo-create&quot;)\n        ;\n    }\n \n    public function store(OligosRequest $request){\n        try{\n            $oligos = $request-&gt;validOligos;\n            $data = $this-&gt;service-&gt;create($oligos);\n \n            return response()-&gt;json(array_merge($data, [\n                &#039;status&#039; =&gt; &#039;success&#039;, \n                &#039;input&#039; =&gt; $oligos,\n            ]), 200);\n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n \n    \/\/ \u691c\u7d22\n    public function search(OligoSearchRequest $request)\n    {\n        try{\n            $query = $request-&gt;validated();\n            $query[&#039;use_regex&#039;] = $query[&#039;use_regex&#039;] ?? false;  \/\/ \u305f\u3076\u3093OligoSearchRequest\u306e\u307b\u3046\u306b\u79fb\u52d5\u3057\u305f\u307b\u3046\u304c\u7f8e\u3057\u3044\n            return response()-&gt;json([\n                &#039;status&#039; =&gt; &#039;success&#039;,\n                &#039;data&#039; =&gt; $this-&gt;service-&gt;search($query),\n            ], 200);\n \n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n \n    public function edit(){\n        return view(&#039;oligo.edit&#039;)\n        -&gt;fragmentIf(request()-&gt;hasHeader(&#039;HX-Request&#039;), &quot;feature-oligo-edit&quot;)\n        ;\n    }\n \n    public function update(OligoRequest $request, Oligo $item){\n        try{\n            $item-&gt;update($request-&gt;validated());\n \n            return response()-&gt;json([\n                &#039;status&#039; =&gt; &#039;success&#039;, \n                &#039;item&#039; =&gt; $item,\n            ], 200);\n        }catch(\\Throwable $e){\n            return response()-&gt;json([&#039;status&#039; =&gt; &#039;error&#039;, &#039;message&#039; =&gt; $e-&gt;getMessage()], 400);\n        }\n    }\n}\n<\/pre>\n<\/div>\n\n-->\n\n\n\n<div style='display: flex; justify-content: center; gap: 4rem;\n  background-color: #ffefd5;\n  '\n>\n  <a href='laravel-04'>\u524d\u3078<\/a>\n\n<a href='.\/'>PHP\u306e\u5b66\u7fd2 \u76ee\u6b21<\/a>\n\n  <a href='laravel-06'>\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":5,"comment_status":"closed","ping_status":"closed","template":"page-programming.php","meta":{"footnotes":""},"class_list":["post-2961","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/pages\/2961","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=2961"}],"version-history":[{"count":24,"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/pages\/2961\/revisions"}],"predecessor-version":[{"id":3162,"href":"https:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/pages\/2961\/revisions\/3162"}],"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=2961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}