{"id":56,"date":"2024-10-11T16:06:17","date_gmt":"2024-10-11T07:06:17","guid":{"rendered":"https:\/\/laravel.satoshis.jp\/?p=56"},"modified":"2024-10-25T14:48:35","modified_gmt":"2024-10-25T05:48:35","slug":"%e3%81%8a%e5%95%8f%e3%81%84%e5%90%88%e3%82%8f%e3%81%9b%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86","status":"publish","type":"post","link":"https:\/\/laravel.satoshis.jp\/?p=56","title":{"rendered":"\u304a\u554f\u3044\u5408\u308f\u305b\u30da\u30fc\u30b8\u3092\u4f5c\u3063\u3066\u307f\u3088\u3046"},"content":{"rendered":"<h4>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u7528\u610f<\/h4>\n<p>MySQL\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; mysql -u root -p\r\n<\/pre>\n<p>MySQL\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u3092\u5272\u308a\u5f53\u3066\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmysql&gt; create database laravel;\r\nQuery OK, 1 row affected (0.00 sec)\r\n\r\nmysql&gt; create user laravel@localhost identified by &#039;laraveldb&#039;;\r\nQuery OK, 0 rows affected (0.01 sec)\r\n\r\nmysql&gt; grant all privileges on laravel.* to laravel@localhost;\r\nQuery OK, 0 rows affected (0.00 sec)\r\n<\/pre>\n<h4>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a<\/h4>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u8a2d\u5b9a\u306f\u3001.env \u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<br \/>\nVSCode\u3067 .env \u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304d\u3001\u4ee5\u4e0b\u306e\u90e8\u5206\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nDB_CONNECTION=mysql\r\nDB_HOST=127.0.0.1\r\nDB_PORT=3306\r\nDB_DATABASE=laravel\r\nDB_USERNAME=laravel\r\nDB_PASSWORD=laraveldb\r\n<\/pre>\n<p>\u3053\u308c\u3067\u3001Laravel\u304b\u3089MySQL\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\nLaravel\u306b\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30e6\u30fc\u30b6\u30fc\u3084\u30ad\u30e3\u30c3\u30b7\u30e5\u95a2\u9023\u306e\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u308c\u3092\u5b9f\u884c\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; php artisan migrate\r\n\r\n   INFO  Preparing database.\r\n\r\n  Creating migration table ............................................................. 27.16ms DONE\r\n\r\n   INFO  Running migrations.\r\n\r\n  0001_01_01_000000_create_users_table ................................................. 79.36ms DONE\r\n  0001_01_01_000001_create_cache_table ................................................. 29.63ms DONE\r\n  0001_01_01_000002_create_jobs_table .................................................. 69.06ms DONE\r\n<\/pre>\n<h4>\u30e6\u30fc\u30b6\u30fc\u8a8d\u8a3c\u6a5f\u80fd\u3092\u6709\u52b9\u306b\u3059\u308b<\/h4>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u306b\u306f\u95a2\u4fc2\u306a\u3044\u3051\u3069\u3001\u30e6\u30fc\u30b6\u30fc\u8a8d\u8a3c\u6a5f\u80fd\u3092\u6709\u52b9\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; composer require laravel\/breeze\r\n&gt; php artisan breeze:install\r\n<\/pre>\n<h4>\u304a\u554f\u3044\u5408\u308f\u305b\u306b\u5bfe\u5fdc\u3059\u308b\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h4>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u306f\u3001\u591a\u304f\u306e\u30b5\u30a4\u30c8\u3067\u306f Contact \u306e\u3088\u3046\u306a\u30da\u30fc\u30b8\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u304a\u554f\u3044\u5408\u308f\u305b\u306b\u5bfe\u5fdc\u3059\u308b\u30e2\u30c7\u30eb\u306e\u540d\u524d\u306f Contact \u3068\u3057\u307e\u3059\u3002<\/p>\n<p>Laravel\u3067\u30e2\u30c7\u30eb\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; php artisan make:model Contact -m\r\n<\/pre>\n<p>\u6700\u5f8c\u306e\u300c-m\u300d\u306f\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30d5\u30a1\u30a4\u30eb\u3082\u540c\u6642\u306b\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>app\\Models\\Contact.php<\/li>\n<li>database\\migrations\\yyyy_mm_dd_hhmmss_create_contacts_table.php<\/li>\n<\/ol>\n<h5>Contact.php<\/h5>\n<p>\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3001Web\u30a2\u30d7\u30ea\u304b\u3089\u3053\u308c\u3089\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u3092\u8a31\u53ef\u3059\u308b\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; highlight: [11,12,13,14,15]; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass Contact extends Model\r\n{\r\n    use HasFactory;\r\n    protected $fillable = &#x5B;\r\n        &#039;name&#039;,\r\n        &#039;email&#039;,\r\n        &#039;body&#039;,\r\n    ];\r\n\r\n}\r\n<\/pre>\n<h5>yyyy_mm_dd_hhmmss_create_contacts_table.php<\/h5>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e contacts \u30c6\u30fc\u30d6\u30eb\u306b\u4f5c\u6210\u3059\u308b\u30ab\u30e9\u30e0\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; highlight: [16,17,18]; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\nuse Illuminate\\Database\\Migrations\\Migration;\r\nuse Illuminate\\Database\\Schema\\Blueprint;\r\nuse Illuminate\\Support\\Facades\\Schema;\r\n\r\nreturn new class extends Migration\r\n{\r\n    \/**\r\n     * Run the migrations.\r\n     *\/\r\n    public function up(): void\r\n    {\r\n        Schema::create(&#039;contacts&#039;, function (Blueprint $table) {\r\n            $table-&gt;id();\r\n            $table-&gt;string(&#039;name&#039;);\r\n            $table-&gt;string(&#039;email&#039;);\r\n            $table-&gt;text(&#039;body&#039;);\r\n            $table-&gt;timestamps();\r\n        });\r\n    }\r\n\r\n    \/**\r\n     * Reverse the migrations.\r\n     *\/\r\n    public function down(): void\r\n    {\r\n        Schema::dropIfExists(&#039;contacts&#039;);\r\n    }\r\n};\r\n<\/pre>\n<h4>\u30d3\u30e5\u30fc\u3092\u4f5c\u6210\u3059\u308b<\/h4>\n<p>Laravel\u306eView\u306b\u5bfe\u5fdc\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u3001resources\\views \u30d5\u30a9\u30eb\u30c0\u306b\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u304a\u554f\u3044\u5408\u308f\u305b\u30da\u30fc\u30b8\u306b\u5bfe\u5fdc\u3059\u308b\u30d3\u30e5\u30fc\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; php artisan make:view contact\r\n<\/pre>\n<p>resources\\views \u306b contact.blade.php \u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>dashboard.blade.php \u3092\u30b3\u30d4\u30fc\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u5185\u5bb9\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u304a\u304a\u3082\u3068\u306e\u30bf\u30b0 x-app-layout \u306f\u3001resources\\views\\layouts\\app.blade.php \u3092\u30ec\u30a4\u30a2\u30a6\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u6307\u5b9a\u3059\u308b\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u72b6\u614b\u3092\u524d\u63d0\u3068\u3057\u3066\u66f8\u304b\u308c\u3066\u3044\u308b\u306e\u3067\u3001app \u306e\u90e8\u5206\u3092 guest \u306b\u5909\u66f4\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001@vite \u306e\u884c\u304c\u3042\u308b\u3068 npm \u3068\u3044\u3046\u30c4\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3001\u3053\u306e\u884c\u306f\u524a\u9664\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;div class=&quot;p-6 text-gray-900&quot;&gt;\r\n                    {{ __(&quot;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;) }}\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n<h4>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4f5c\u6210\u3059\u308b<\/h4>\n<p>Laravel\u3067\u306f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u5bfe\u5fdc\u3059\u308b\u30af\u30e9\u30b9\u306f App\\Http\\Controllers \u30d5\u30a9\u30eb\u30c0\u306b\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067 Contact \u306b\u95a2\u9023\u3059\u308b\u5236\u5fa1\u3092\u304a\u3053\u306a\u3046\u3001ContactController \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; php artisan make:controller ContactController\r\n<\/pre>\n<p>ContactController.php \u306e\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse Illuminate\\Http\\Request;\r\n\r\nclass ContactController extends Controller\r\n{\r\n    public function index()\r\n    {\r\n        return view(&#039;contact&#039;);\r\n    }\r\n}\r\n<\/pre>\n<p>resources\\views\\layouts\\guest.blade.php \u306f15\u884c\u76ee\u306e @vite \u306e\u884c\u3092\u524a\u9664\u3057\u3001\u3055\u3089\u306b\u3001\u30ed\u30b4\u304c\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b div \u3092\u307e\u308b\u3054\u3068\u524a\u9664\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html lang=&quot;{{ str_replace(&#039;_&#039;, &#039;-&#039;, app()-&gt;getLocale()) }}&quot;&gt;\r\n    &lt;head&gt;\r\n        &lt;meta charset=&quot;utf-8&quot;&gt;\r\n        &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;\r\n        &lt;meta name=&quot;csrf-token&quot; content=&quot;{{ csrf_token() }}&quot;&gt;\r\n\r\n        &lt;title&gt;{{ config(&#039;app.name&#039;, &#039;Laravel&#039;) }}&lt;\/title&gt;\r\n\r\n        &lt;!-- Fonts --&gt;\r\n        &lt;link rel=&quot;preconnect&quot; href=&quot;https:\/\/fonts.bunny.net&quot;&gt;\r\n        &lt;link href=&quot;https:\/\/fonts.bunny.net\/css?family=figtree:400,500,600&amp;display=swap&quot; rel=&quot;stylesheet&quot; \/&gt;\r\n\r\n        &lt;!-- Scripts --&gt;\r\n    &lt;\/head&gt;\r\n    &lt;body class=&quot;font-sans text-gray-900 antialiased&quot;&gt;\r\n        &lt;div class=&quot;min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100&quot;&gt;\r\n            &lt;div class=&quot;w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg&quot;&gt;\r\n                {{ $slot }}\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h4>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u5b9a\u7fa9\u3059\u308b<\/h4>\n<p>\u3069\u306eURL\u306b\u30a2\u30af\u30bb\u30b9\u304c\u6765\u305f\u3068\u304d\u306b\u3001\u3069\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u5236\u5fa1\u3092\u6e21\u3059\u306e\u304b\u3092\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u3044\u3044\u307e\u3059\u3002<\/p>\n<p>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u3001routes\/web.php \u3067\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u306b\u3001\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; highlight: [3,11]; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\nuse App\\Http\\Controllers\\ContactController;\r\nuse App\\Http\\Controllers\\ProfileController;\r\nuse Illuminate\\Support\\Facades\\Route;\r\n\r\nRoute::get(&#039;\/&#039;, function () {\r\n    return view(&#039;welcome&#039;);\r\n});\r\n\r\nRoute::get(&#039;\/contact&#039;, &#x5B;ContactController::class, &#039;index&#039;]);\r\n\r\nRoute::get(&#039;\/dashboard&#039;, function () {\r\n    return view(&#039;dashboard&#039;);\r\n})-&gt;middleware(&#x5B;&#039;auth&#039;, &#039;verified&#039;])-&gt;name(&#039;dashboard&#039;);\r\n\r\nRoute::middleware(&#039;auth&#039;)-&gt;group(function () {\r\n    Route::get(&#039;\/profile&#039;, &#x5B;ProfileController::class, &#039;edit&#039;])-&gt;name(&#039;profile.edit&#039;);\r\n    Route::patch(&#039;\/profile&#039;, &#x5B;ProfileController::class, &#039;update&#039;])-&gt;name(&#039;profile.update&#039;);\r\n    Route::delete(&#039;\/profile&#039;, &#x5B;ProfileController::class, &#039;destroy&#039;])-&gt;name(&#039;profile.destroy&#039;);\r\n});\r\n\r\nrequire __DIR__.&#039;\/auth.php&#039;;\r\n<\/pre>\n<p>\u3053\u308c\u3067\u3001<a href=\"http:\/\/localhost:8000\/contact\">http:\/\/localhost:8000\/contact<\/a>\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u304a\u554f\u3044\u5408\u308f\u305b\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u30da\u30fc\u30b8\u306b\u3001\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;div class=&quot;p-6 text-gray-900&quot;&gt;\r\n                    {{ __(&quot;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;) }}\r\n                &lt;\/div&gt;\r\n                &lt;div&gt;\r\n                    &lt;form action=&quot;&quot; method=&quot;post&quot;&gt;\r\n                        @csrf\r\n                        \u304a\u540d\u524d: &lt;input type=&quot;text&quot; name=&quot;name&quot; \/&gt;&lt;\/br&gt;\r\n                        Email: &lt;input type=&quot;text&quot; name=&quot;email&quot; \/&gt;&lt;\/br&gt;\r\n                        \u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9:\r\n                        &lt;textarea name=&quot;body&quot;&gt;&lt;\/textarea&gt;&lt;\/br&gt;\r\n                        &lt;button&gt;\u9001\u4fe1&lt;\/button&gt;\r\n                    &lt;\/form&gt;\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n<h4>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306bPOST\u5148\u3092\u8ffd\u52a0\u3059\u308b<\/h4>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u306e\u30c7\u30fc\u30bf\u306e\u9001\u4fe1\u5148\u3068\u306a\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; highlight: [12]; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\nuse App\\Http\\Controllers\\ContactController;\r\nuse App\\Http\\Controllers\\ProfileController;\r\nuse Illuminate\\Support\\Facades\\Route;\r\n\r\nRoute::get(&#039;\/&#039;, function () {\r\n    return view(&#039;welcome&#039;);\r\n});\r\n\r\nRoute::get(&#039;\/contact&#039;, &#x5B;ContactController::class, &#039;index&#039;]);\r\nRoute::post(&#039;\/post&#039;, &#x5B;ContactController::class, &#039;post&#039;])-&gt;name(&#039;contact.post&#039;);\r\n\r\n<\/pre>\n<h4>form\u306eaction\u5c5e\u6027\u3092\u5909\u66f4\u3059\u308b<\/h4>\n<p>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3067POST\u5148\u3092\u8ffd\u52a0\u3057\u305f\u306e\u3067\u3001\u305d\u306eURL\u306b\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u3088\u3046\u306b\u3001form\u30bf\u30b0\u306eaction\u5c5e\u6027\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u5bfe\u3057\u3066name(&#8216;contact.post)\u3068\u3057\u3066\u540d\u524d\u3092\u4ed8\u3051\u3066\u304a\u3044\u305f\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308c\u3070\u3001Laravel\u304c\u81ea\u52d5\u7684\u306b&#8217;\/post&#8217;\u306b\u5909\u63db\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>@csrf \u306e\u5185\u5bb9\u3082input\u30bf\u30b0\u306b\u5909\u63db\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001devtool\u3067\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: xml; first-line: 14; highlight: [15]; title: ; notranslate\" title=\"\">\r\n                &lt;div&gt;\r\n                    &lt;form action=&quot;{{ route(&#039;contact.post&#039;) }}&quot; method=&quot;post&quot;&gt;\r\n                        @csrf\r\n                        \u304a\u540d\u524d: &lt;input type=&quot;text&quot; name=&quot;name&quot; \/&gt;&lt;\/br&gt;\r\n                        Email: &lt;input type=&quot;text&quot; name=&quot;email&quot; \/&gt;&lt;\/br&gt;\r\n                        \u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9:\r\n                        &lt;textarea name=&quot;body&quot;&gt;&lt;\/textarea&gt;&lt;\/br&gt;\r\n                        &lt;button&gt;\u9001\u4fe1&lt;\/button&gt;\r\n                    &lt;\/form&gt;\r\n                &lt;\/div&gt;\r\n<\/pre>\n<h4>\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u306e\u30c7\u30fc\u30bf\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u53d7\u3051\u53d6\u308b<\/h4>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u306e\u30c7\u30fc\u30bf\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u53d7\u3051\u53d6\u3063\u3066\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: php; highlight: [15,16,17,18,19,20,21,22,23]; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse Illuminate\\Http\\Request;\r\nuse App\\Models\\Contact;\r\n\r\nclass ContactController extends Controller\r\n{\r\n    public function index()\r\n    {\r\n        return view(&#039;contact&#039;);\r\n    }\r\n\r\n    public function post(Request $request)\r\n    {\r\n        Contact::create(&#x5B;\r\n            &#039;name&#039; =&gt; $request-&gt;input(&#039;name&#039;),\r\n            &#039;email&#039; =&gt; $request-&gt;input(&#039;email&#039;),\r\n            &#039;body&#039; =&gt; $request-&gt;input(&#039;body&#039;),\r\n        ]);\r\n        return view(&#039;posted&#039;);\r\n    }\r\n}\r\n<\/pre>\n<p>post\u30e1\u30bd\u30c3\u30c9\u306e\u6700\u5f8c\u3067 posted \u30d3\u30e5\u30fc\u3092\u8868\u793a\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u4f5c\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; php artisan make:view posted\r\n<\/pre>\n<p>\u4ee5\u4e0b\u306e\u5185\u5bb9\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;div class=&quot;p-6 text-gray-900&quot;&gt;\r\n                    {{ __(&quot;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3057\u305f\u3002&quot;) }}\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n<h4>\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u9001\u4fe1\u3057\u3066\u307f\u308b<\/h4>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u30da\u30fc\u30b8\u3067\u540d\u524d\u3068\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3068\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u5165\u529b\u3057\u3066\u9001\u4fe1\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u3001\u5165\u529b\u3057\u305f\u5185\u5bb9\u304c\u767b\u9332\u3055\u308c\u3066\u3044\u308c\u3070OK\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3082\u78ba\u8a8d\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; php artisan tinker\r\nPsy Shell v0.12.4 (PHP 8.2.12 \u2014 cli) by Justin Hileman\r\n&gt; App\\Models\\Contact::all()                                                                                       \r\n= Illuminate\\Database\\Eloquent\\Collection {#5980\r\n    all: &#x5B;\r\n      App\\Models\\Contact {#5571\r\n        id: 1,\r\n        name: &quot;asdf&quot;,\r\n        email: &quot;asdf@example.com&quot;,\r\n        body: &quot;&quot;&quot;\r\n          \u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\\r\\n\r\n          \u8907\u6570\u884c\\r\\n\r\n          \u3042\u3042\u3042\u3042\r\n          &quot;&quot;&quot;,\r\n        created_at: &quot;2024-10-18 06:19:42&quot;,\r\n        updated_at: &quot;2024-10-18 06:19:42&quot;,\r\n      },\r\n    ],\r\n  }\r\n\r\n&gt;\r\n<\/pre>\n<h4>\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b\u30da\u30fc\u30b8\u3092\u9593\u306b\u631f\u3080<\/h4>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u5165\u529b\u3057\u305f\u3089\u3001\u78ba\u8a8d\u30dc\u30bf\u30f3\u3067\u78ba\u8a8d\u753b\u9762\u306b\u9077\u79fb\u3057\u3066\u3001\u78ba\u8a8d\u5f8c\u306b\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3059\u308b\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001contact.blade.php \u3092\u5c11\u3057\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; highlight: [15,21]; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;div class=&quot;p-6 text-gray-900&quot;&gt;\r\n                    {{ __(&quot;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;) }}\r\n                &lt;\/div&gt;\r\n                &lt;div&gt;\r\n                    &lt;form action=&quot;{{ route(&#039;contact.confirm&#039;) }}&quot; method=&quot;post&quot;&gt;\r\n                        @csrf\r\n                        \u304a\u540d\u524d: &lt;input type=&quot;text&quot; name=&quot;name&quot; \/&gt;&lt;\/br&gt;\r\n                        Email: &lt;input type=&quot;text&quot; name=&quot;email&quot; \/&gt;&lt;\/br&gt;\r\n                        \u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9:\r\n                        &lt;textarea name=&quot;body&quot;&gt;&lt;\/textarea&gt;&lt;\/br&gt;\r\n                        &lt;button&gt;\u78ba\u8a8d&lt;\/button&gt;\r\n                    &lt;\/form&gt;\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n<p>15\u884c\u76ee\u3092 route(&#8216;contact.confirm&#8217;) \u306b\u5909\u66f4\u3057\u305f\u306e\u3067\u3001\u3053\u308c\u3092\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; first-line: 11; highlight: [12]; title: ; notranslate\" title=\"\">\r\nRoute::get(&#039;\/contact&#039;, &#x5B;ContactController::class, &#039;index&#039;]);\r\nRoute::post(&#039;\/confirm&#039;, &#x5B;ContactController::class, &#039;confirm&#039;])-&gt;name(&#039;contact.confirm&#039;);\r\nRoute::post(&#039;\/post&#039;, &#x5B;ContactController::class, &#039;post&#039;])-&gt;name(&#039;contact.post&#039;);\r\n<\/pre>\n<p>ContactController\u306bconfirm\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; first-line: 15; title: ; notranslate\" title=\"\">\r\n    public function confirm(Request $request)\r\n    {\r\n        $contact = new Contact;\r\n        $contact-&gt;name = $request-&gt;input(&#039;name&#039;);\r\n        $contact-&gt;email = $request-&gt;input(&#039;email&#039;);\r\n        $contact-&gt;body = $request-&gt;input(&#039;body&#039;);\r\n        return view(&#039;confirm&#039;, compact(&#039;contact&#039;));\r\n    }\r\n<\/pre>\n<h4>\u78ba\u8a8d\u753b\u9762\u3092\u4f5c\u6210\u3059\u308b<\/h4>\n<p>\u78ba\u8a8d\u753b\u9762\u3067\u306f\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304b\u3089\u53d7\u3051\u53d6\u3063\u305f\u30c7\u30fc\u30bf\u3092\u8868\u793a\u3059\u308b\u3068\u3068\u3082\u306b\u3001<br \/>\n\u30d5\u30a9\u30fc\u30e0\u5185\u3067\u306f input \u30bf\u30b0\u306e type\u3000\u5c5e\u6027\u3092 hidden \u306b\u3057\u3066\u9001\u4fe1\u7528\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; highlight: [15,16,17,18,19,20,21,22,23,24,25]; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;div class=&quot;p-6 text-gray-900&quot;&gt;\r\n                    {{ __(&quot;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;) }}\r\n                &lt;\/div&gt;\r\n                &lt;div&gt;\r\n                    &lt;div&gt;\u304a\u540d\u524d: {{ $contact-&gt;name }}&lt;\/div&gt;\r\n                    &lt;div&gt;Email: {{ $contact-&gt;email }}&lt;\/div&gt;\r\n                    &lt;div&gt;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9:&lt;\/div&gt;\r\n                    &lt;div&gt;{{ $contact-&gt;body }}&lt;\/div&gt;\r\n                    &lt;form action=&quot;{{ route(&#039;contact.post&#039;) }}&quot; method=&quot;post&quot;&gt;\r\n                        @csrf\r\n                        &lt;input type=&quot;hidden&quot; name=&quot;name&quot; value=&quot;{{ $contact-&gt;name }}&quot; \/&gt;&lt;\/br&gt;\r\n                        &lt;input type=&quot;hidden&quot; name=&quot;email&quot; value=&quot;{{ $contact-&gt;email }}&quot; \/&gt;&lt;\/br&gt;\r\n                        &lt;input type=&quot;hidden&quot; name=&quot;body&quot; value=&quot;{{ $contact-&gt;body }}&quot; \/&gt;\r\n                        &lt;button&gt;\u9001\u4fe1&lt;\/button&gt;\r\n                    &lt;\/form&gt;\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n<p>\u3053\u308c\u3060\u3068\u3001\u78ba\u8a8d\u753b\u9762\u3067\u306f\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u306e\u6539\u884c\u304c\u3046\u307e\u304f\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u8907\u6570\u884c\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u3001nl2br() \u95a2\u6570\u3092\u4f7f\u3063\u3066\u6539\u884c\u30b3\u30fc\u30c9\u3092 br \u30bf\u30b0\u306b\u5909\u66f4\u3059\u308b\u3088\u3046\u306b\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; highlight: [18]; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;div class=&quot;p-6 text-gray-900&quot;&gt;\r\n                    {{ __(&quot;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;) }}\r\n                &lt;\/div&gt;\r\n                &lt;div&gt;\r\n                    &lt;div&gt;\u304a\u540d\u524d: {{ $contact-&gt;name }}&lt;\/div&gt;\r\n                    &lt;div&gt;Email: {{ $contact-&gt;email }}&lt;\/div&gt;\r\n                    &lt;div&gt;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9:&lt;\/div&gt;\r\n                    &lt;div&gt;{!! nl2br($contact-&gt;body) !!}&lt;\/div&gt;\r\n                    &lt;form action=&quot;{{ route(&#039;contact.post&#039;) }}&quot; method=&quot;post&quot;&gt;\r\n                        @csrf\r\n                        &lt;input type=&quot;hidden&quot; name=&quot;name&quot; value=&quot;{{ $contact-&gt;name }}&quot; \/&gt;&lt;\/br&gt;\r\n                        &lt;input type=&quot;hidden&quot; name=&quot;email&quot; value=&quot;{{ $contact-&gt;email }}&quot; \/&gt;&lt;\/br&gt;\r\n                        &lt;input type=&quot;hidden&quot; name=&quot;body&quot; value=&quot;{{ $contact-&gt;body }}&quot; \/&gt;\r\n                        &lt;button&gt;\u9001\u4fe1&lt;\/button&gt;\r\n                    &lt;\/form&gt;\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n<h4>\u304a\u554f\u3044\u5408\u308f\u305b\u306e\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3059\u308b<\/h4>\n<p>\u6295\u7a3f\u3055\u308c\u305f\u304a\u554f\u3044\u5408\u308f\u305b\u306e\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u304a\u554f\u3044\u5408\u308f\u305b\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306eURL\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; first-line: 11; highlight: [14]; title: ; notranslate\" title=\"\">\r\nRoute::get(&#039;\/contact&#039;, &#x5B;ContactController::class, &#039;index&#039;]);\r\nRoute::post(&#039;\/confirm&#039;, &#x5B;ContactController::class, &#039;confirm&#039;])-&gt;name(&#039;contact.confirm&#039;);\r\nRoute::post(&#039;\/post&#039;, &#x5B;ContactController::class, &#039;post&#039;])-&gt;name(&#039;contact.post&#039;);\r\nRoute::get(&#039;\/contact-list&#039;, &#x5B;ContactController::class, &#039;list&#039;])-&gt;name(&#039;contact.list&#039;);\r\n<\/pre>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306blist()\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; first-line: 34; title: ; notranslate\" title=\"\">\r\n    public function list()\r\n    {\r\n        $contacts = Contact::orderBy(&#039;created_at&#039;, &#039;desc&#039;)-&gt;get();\r\n        return view(&#039;contacts&#039;, compact(&#039;contacts&#039;));\r\n    }\r\n<\/pre>\n<p>\u30d3\u30e5\u30fc\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; php artisan make:view contacts\r\n<\/pre>\n<p>\u30d3\u30e5\u30fc\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b\u4e00\u89a7&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;table&gt;\r\n                    &lt;tr&gt;\r\n                        &lt;th&gt;\u65e5\u6642&lt;\/th&gt;\r\n                        &lt;th&gt;\u540d\u524d&lt;\/th&gt;\r\n                    &lt;\/tr&gt;\r\n                    @foreach($contacts as $contact)\r\n                    &lt;tr&gt;\r\n                        &lt;td&gt;{{ $contact-&gt;created_at }}&lt;\/td&gt;\r\n                        &lt;td&gt;{{ $contact-&gt;name }}&lt;\/td&gt;\r\n                    &lt;\/tr&gt;\r\n                    @endforeach\r\n                &lt;\/table&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n<p>\u65e5\u6642\u306e\u6642\u9593\u5e2f\u304c\u5909\u306a\u306e\u3067\u3001\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n.env \u30d5\u30a1\u30a4\u30eb\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nAPP_TIMEZONE=Asia\/Tokyo\r\n<\/pre>\n<h4>\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9\u306e\u8a73\u7d30\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3059\u308b<\/h4>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u4e00\u89a7\u30da\u30fc\u30b8\u3067\u3001\u540d\u524d\u306e\u3068\u3053\u308d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u304a\u554f\u3044\u5408\u308f\u305b\u306e\u8a73\u7d30\u3092\u8868\u793a\u3059\u308b\u30da\u30fc\u30b8\u306b\u9077\u79fb\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u8a73\u7d30\u30da\u30fc\u30b8\u306b\u5bfe\u5fdc\u3059\u308bURL\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; first-line: 11; highlight: [15]; title: ; notranslate\" title=\"\">\r\nRoute::get(&#039;\/contact&#039;, &#x5B;ContactController::class, &#039;index&#039;]);\r\nRoute::post(&#039;\/confirm&#039;, &#x5B;ContactController::class, &#039;confirm&#039;])-&gt;name(&#039;contact.confirm&#039;);\r\nRoute::post(&#039;\/post&#039;, &#x5B;ContactController::class, &#039;post&#039;])-&gt;name(&#039;contact.post&#039;);\r\nRoute::get(&#039;\/contact-list&#039;, &#x5B;ContactController::class, &#039;list&#039;])-&gt;name(&#039;contact.list&#039;);\r\nRoute::get(&#039;\/contact-detail\/{id}&#039;, &#x5B;ContactController::class, &#039;contact&#039;])-&gt;name(&#039;contact.detail&#039;);\r\n<\/pre>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306bcontact()\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; first-line: 40; title: ; notranslate\" title=\"\">\r\n    public function contact($id)\r\n    {\r\n        $contact = Contact::find($id);\r\n        return view(&#039;contact-detail&#039;, compact(&#039;contact&#039;));\r\n    }\r\n<\/pre>\n<p>\u304a\u554f\u3044\u5408\u308f\u305b\u8a73\u7d30\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&gt; php artisan make:view contact-detail\r\n<\/pre>\n<p>contact-detail.blade.php \u306f\u3001\u4ee5\u4e0b\u306e\u5185\u5bb9\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;div&gt;\r\n                    &lt;div&gt;\u65e5\u6642: {{ $contact-&gt;created_at }}&lt;\/div&gt;\r\n                    &lt;div&gt;\u304a\u540d\u524d: {{ $contact-&gt;name }}&lt;\/div&gt;\r\n                    &lt;div&gt;Email: {{ $contact-&gt;email }}&lt;\/div&gt;\r\n                    &lt;div&gt;\u304a\u554f\u3044\u5408\u308f\u305b\u5185\u5bb9:&lt;\/div&gt;\r\n                    &lt;div&gt;{!! nl2br($contact-&gt;body) !!}&lt;\/div&gt;\r\n                &lt;\/div&gt;\r\n                &lt;a href=&quot;{{ route(&#039;contact.list&#039;) }}&quot;&gt;\u4e00\u89a7\u306b\u623b\u308b&lt;\/a&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n<p>\u4e00\u89a7\u30da\u30fc\u30b8\u306e\u540d\u524d\u306e\u90e8\u5206\u3092\u30ea\u30f3\u30af\u306b\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; highlight: [19]; title: ; notranslate\" title=\"\">\r\n&lt;x-guest-layout&gt;\r\n    &lt;x-slot name=&quot;header&quot;&gt;\r\n        &lt;h2 class=&quot;font-semibold text-xl text-gray-800 leading-tight&quot;&gt;\r\n            {{ __(&#039;\u304a\u554f\u3044\u5408\u308f\u305b\u4e00\u89a7&#039;) }}\r\n        &lt;\/h2&gt;\r\n    &lt;\/x-slot&gt;\r\n\r\n    &lt;div class=&quot;py-12&quot;&gt;\r\n        &lt;div class=&quot;max-w-7xl mx-auto sm:px-6 lg:px-8&quot;&gt;\r\n            &lt;div class=&quot;bg-white overflow-hidden shadow-sm sm:rounded-lg&quot;&gt;\r\n                &lt;table&gt;\r\n                    &lt;tr&gt;\r\n                        &lt;th&gt;\u65e5\u6642&lt;\/th&gt;\r\n                        &lt;th&gt;\u540d\u524d&lt;\/th&gt;\r\n                    &lt;\/tr&gt;\r\n                    @foreach($contacts as $contact)\r\n                    &lt;tr&gt;\r\n                        &lt;td&gt;{{ $contact-&gt;created_at }}&lt;\/td&gt;\r\n                        &lt;td&gt;&lt;a href=&quot;{{ route(&#039;contact.detail&#039;, $contact-&gt;id) }}&quot;&gt;{{ $contact-&gt;name }}&lt;\/a&gt;&lt;\/td&gt;\r\n                    &lt;\/tr&gt;\r\n                    @endforeach\r\n                &lt;\/table&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/x-guest-layout&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u7528\u610f MySQL\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002 &gt; mysql -u root -p MySQL\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u3092\u5272\u308a\u5f53\u3066\u307e\u3059\u3002 m &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-56","post","type-post","status-publish","format-standard","hentry","category-basics"],"_links":{"self":[{"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=56"}],"version-history":[{"count":21,"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/56\/revisions"}],"predecessor-version":[{"id":78,"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/56\/revisions\/78"}],"wp:attachment":[{"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laravel.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}