{"id":11621,"date":"2023-05-22T07:00:03","date_gmt":"2023-05-21T22:00:03","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=11621"},"modified":"2023-05-09T20:47:51","modified_gmt":"2023-05-09T11:47:51","slug":"%e3%80%90laravel-10-x%e3%80%91%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%aa%e3%81%97%e3%81%a7%e3%82%82%e3%83%87%e3%83%bc%e3%82%bf%e4%bf%9d%e6%8c%81%e3%81%a7%e3%81%8d%e3%81%a6%e3%80%81%e3%83%a6","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=11621","title":{"rendered":"\u3010Laravel 10.x\u3011\u30ed\u30b0\u30a4\u30f3\u306a\u3057\u3067\u3082\u30c7\u30fc\u30bf\u4fdd\u6301\u3067\u304d\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u305f\u3089DB\u3078\u79fb\u884c\u3059\u308b\u6a5f\u80fd"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u306f\u6642\u9593\u3092\u898b\u3064\u3051\u3066\u500b\u4eba\u7684\u306b\u30b5\u30a4\u30c8\u3092\u4f5c\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066\u3001\u305d\u306e\u7d4c\u9a13\u306e\u4e2d\u30db\u30f3\u30c8\u306b\u96e3\u3057\u3044\u3068\u611f\u3058\u3066\u3044\u308b\u306e\u304c\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u3066\u3082\u3089\u3046\u3053\u3068<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306e\u77e5\u8b58\u304c\u4e4f\u3057\u3044\u306e\u306f\u627f\u77e5\u306e\u4e0a\u3067\u3059\u304c\u3001\u3084\u306f\u308a\u500b\u4eba\u7684\u306a\u30b5\u30a4\u30c8\u306f\u30c7\u30b6\u30a4\u30f3\u306a\u3069\u306b\u305d\u308c\u307b\u3069\u304a\u91d1\u3092\u304b\u3051\u308b\u3053\u3068\u3082\u3067\u304d\u305a\u300c<strong>\u30e6\u30fc\u30b6\u30fc\u767b\u9332<\/strong>\u300d\u3057\u3066\u3082\u3089\u3046\u307e\u3067\u306e\u58c1\u304c\u7d50\u69cb\u9ad8\u3044\u306e\u304c\u79c1\u306e\u5370\u8c61\u3067\u3059\u3002<\/p>\n<p>\u3068\u306a\u308b\u3068\u3001\u30ed\u30b0\u30a4\u30f3\u3057\u306a\u304f\u3066\u3082\u30b5\u30a4\u30c8\u3092\u5229\u7528\u3057\u3066\u3082\u3089\u3046\u305f\u3081\u306b\u4f55\u304c\u5fc5\u8981\u304b\u3044\u304f\u3064\u304b\u8003\u3048\u305f\u306e\u3067\u3059\u304c\u3001\u3072\u3068\u3064\u306e\u30a2\u30a4\u30c7\u30a2\u304c\u6d6e\u304b\u3073\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u304c\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u767b\u9332\u3057\u3066\u306a\u3044\u4eba\u3067\u3082 Cookie \u3067\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3057\u3001\u3082\u3057\u767b\u9332\u3057\u305f\u3089\u305d\u306e\u30c7\u30fc\u30bf\u3092DB\u306b\u5f15\u304d\u7d99\u3050<\/strong><\/p>\n<p>\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u6700\u521d\u306f\u30d6\u30e9\u30a6\u30b6\u306b\u30c7\u30fc\u30bf\u3092\u4fdd\u6301\u3057\u3066\u304a\u3044\u3066\u30b5\u30a4\u30c8\u3092\u6c17\u306b\u5165\u3063\u3066\u3082\u3089\u3048\u305f\u3089\u300c<strong>\u30e6\u30fc\u30b6\u30fc\u767b\u9332\uff06\u30c7\u30fc\u30bf\u5f15\u304d\u7d99\u304e<\/strong>\u300d\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<br \/>\n\u4eca\u56de\u306f\u3053\u306e\u6a5f\u80fd\u3092\u300c<strong>Laravel 10.x \uff0b React<\/strong>\u300d\u3067\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002\ud83d\ude04<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3405 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png\" alt=\"\" width=\"310\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png 310w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18-291x300.png 291w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/>\u300c\u30ab\u30ca\u30c0\u306e\u53cb\u4eba\u304c<br \/>\n\u4e00\u56de\u3060\u3051\u30ab\u30e9\u30aa\u30b1\u3067\u805e\u3044\u305f<br \/>\n\u3061\u3073\u307e\u308b\u5b50\u3061\u3083\u3093\u306e\u6b4c\u3092\u899a\u3048\u3066\u307e\u3057\u305f\ud83d\ude04\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 10.x\u3001React\u3001Inertia.js\u3001TailwindCSS\u3001ChatGPT 4\uff08\u30d9\u30fc\u30b9\u306e\u307f\uff09<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p><code>Laravel 10.x<\/code>\u306b\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<\/p>\n<p>\u3082\u3057\u307e\u3060\u306e\u65b9\u306f\u3001\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002\uff08\u5b9f\u969b\u306b\u306f<code>Laravel 8.x<\/code>\u3067\u3059\u304c\u540c\u3058\u304f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u308b\u306f\u305a\u3067\u3059\ud83d\udc4d\uff09<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003\u30da\u30fc\u30b8\uff1a<\/strong> <a href=\"https:\/\/blog.capilano-fw.com\/?p=8301\" target=\"_blank\" rel=\"noopener\">Laravel Breeze\u3067\u300c\u30b7\u30f3\u30d7\u30eb\u306a\u300d\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u6761\u4ef6\u3067\u30e6\u30fc\u30b6\u30fc\u306e\u300c<strong>\u30d7\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/strong>\u300d\uff08\u597d\u307f\u306e\u8a2d\u5b9a\u3002\u4f8b\u3048\u3070\u3001\u30c0\u30fc\u30af\u30e2\u30fc\u30c9\u3092\u4f7f\u3046 or \u4f7f\u308f\u306a\u3044\u306a\u3069\u306e\u8a2d\u5b9a\uff09\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u6761\u4ef6\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u305f\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u30c7\u30fc\u30bf\u53d6\u5f97\u3059\u308b<\/li>\n<li>\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u304b\u3063\u305f\u3089 Cookie \u304b\u3089\u30c7\u30fc\u30bf\u53d6\u5f97\u3059\u308b<\/li>\n<\/ul>\n<p>\u3067\u306f\u697d\u3057\u3093\u3067\u3084\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<h1>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\uff06\u30e2\u30c7\u30eb\u3092\u3064\u304f\u308b<\/h1>\n<p>\u307e\u305a\u306f<code>DB<\/code>\u307e\u308f\u308a\u306e\u6e96\u5099\u304b\u3089\u59cb\u3081\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u30c6\u30fc\u30d6\u30eb\u306f\u300c<strong>preferences<\/strong>\u300d\u306b\u3057\u307e\u3059\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:model Preference -m<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u305d\u308c\u305e\u308c\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Models\/Preference.php<\/strong><\/p>\n<pre>&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 Preference extends Model\r\n{\r\n    use HasFactory;\r\n\r\n    <strong>protected $guarded = ['id']; \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n}\r\n<\/pre>\n<p><strong>database\/migrations\/YYYY_MM_DD_HHMMSS_create_preferences_table.php<\/strong><\/p>\n<pre>public function up()\r\n{\r\n    <strong>Schema::create('preferences', function (Blueprint $table) {\r\n        $table-&gt;id();\r\n        $table-&gt;unsignedBigInteger('user_id')-&gt;index();\r\n        $table-&gt;string('key');\r\n        $table-&gt;text('value');\r\n        $table-&gt;timestamps();\r\n\r\n        \u200b$table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');\r\n        $table-&gt;unique(['user_id', 'key']);\r\n    });<\/strong>\r\n}<\/pre>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u518d\u69cb\u7bc9\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan migrate:fresh --seed<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u5b9f\u969b\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11627\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_1.png\" alt=\"\" width=\"365\" height=\"291\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_1.png 365w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_1-300x239.png 300w\" sizes=\"auto, (max-width: 365px) 100vw, 365px\" \/><\/p>\n<h1>DB \/ Cookie \u304b\u3089\u30c7\u30fc\u30bf\u53d6\u5f97\u3059\u308b<\/h1>\n<p>\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u6761\u4ef6\u3067\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u305f\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089<\/li>\n<li>\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u304b\u3063\u305f\u3089 Cookie \u304b\u3089<\/li>\n<\/ul>\n<p>\u4eca\u56de\u306f\u3001<code>Ajax<\/code>\u3067\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u306e\u3067\u3001\u5c02\u7528\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:controller PreferenceController<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/PreferenceController.php<\/strong><\/p>\n<pre><strong>&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse App\\Models\\Preference;\r\nuse Illuminate\\Http\\Request;\r\nuse Illuminate\\Support\\Facades\\Cookie;\r\nuse Inertia\\Inertia;\r\n\r\nclass PreferenceController extends Controller\r\n{\r\n    public function index(Request $request)\r\n    {\r\n        \/\/ \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306f\u7701\u7565\u3057\u3066\u3044\u307e\u3059\r\n\r\n        $preference_keys = $request-&gt;input('keys', []);\r\n\r\n        if(count($preference_keys) === 0) {\r\n\r\n            return [];\r\n\r\n        }\r\n\r\n        $preferences = [];\r\n\r\n        if (auth()-&gt;check()) {\r\n\r\n            $preferences = Preference::query()\r\n                -&gt;where('user_id', auth()-&gt;id())\r\n                -&gt;whereIn('key', $preference_keys)\r\n                -&gt;pluck('value', 'key')\r\n                -&gt;toArray();\r\n\r\n        } else {\r\n\r\n            foreach ($preference_keys as $preference_key) {\r\n\r\n                $cookie_key = 'preferences:'. $preference_key;\r\n                $cookie_value = Cookie::get($cookie_key);\r\n\r\n                if (! is_null($cookie_value)) {\r\n\r\n                    $preferences[$preference_key] = $cookie_value;\r\n\r\n                }\r\n\r\n            }\r\n        }\r\n\r\n        return $preferences;\r\n    }\r\n\r\n    public function edit()\r\n    {\r\n        return Inertia::render('Preferences\/Edit');\r\n    }\r\n\r\n    public function update(Request $request)\r\n    {\r\n        \/\/ \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306f\u7701\u7565\u3057\u3066\u3044\u307e\u3059\r\n\r\n        $results = [];\r\n        $preferences = $request-&gt;input('preferences', []);\r\n        $response = response();\r\n\r\n        if (auth()-&gt;check()) {\r\n\r\n            foreach ($preferences as $key =&gt; $value) {\r\n\r\n                $preference = Preference::firstOrNew([\r\n                    'user_id' =&gt; auth()-&gt;id(),\r\n                    'key' =&gt; $key,\r\n                ]);\r\n                $preference-&gt;user_id = auth()-&gt;id();\r\n                $preference-&gt;key = $key;\r\n                $preference-&gt;value = $value;\r\n                $results[] = $preference-&gt;save();\r\n\r\n            }\r\n\r\n        } else {\r\n\r\n            foreach ($preferences as $key =&gt; $value) {\r\n\r\n                $cookie_key = 'preferences:'. $key;\r\n\r\n                try {\r\n\r\n                    $minutes = 525600; \/\/ 1\u5e74\r\n                    Cookie::queue($cookie_key, $value, $minutes);\r\n\r\n                    $results[] = true;\r\n\r\n                } catch (\\Exception $e) {\r\n\r\n                    $results[] = false;\r\n\r\n                }\r\n\r\n            }\r\n\r\n        }\r\n\r\n        $result = ! in_array(false, $results, true);\r\n\r\n        return $response-&gt;json(['result' =&gt; $result]);\r\n    }\r\n}<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<h2>index()<\/h2>\n<p>\u3053\u3053\u306f<code>ajax<\/code>\u3092\u901a\u3057\u3066\u30d7\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3053\u306e\u4e2d\u3067\u306f\u300c<strong>\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b or \u3057\u3066\u306a\u3044<\/strong>\u300d\u3067\u5206\u5c90\u3057\u3001\u305d\u308c\u305e\u308c<code>DB<\/code>\u3068<code>Cookie<\/code>\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>edit()<\/h2>\n<p>\u3053\u3053\u306f\u30e6\u30fc\u30b6\u30fc\u304c\u5b9f\u969b\u306b\u30d7\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306e\u9078\u629e\u3092\u3057\u3001\u4fdd\u5b58\u3092\u3059\u308b\u30da\u30fc\u30b8\u3067\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u3067\u3059\u306e\u3067\u3001<code>theme<\/code>\u3067\u300c\u30e9\u30a4\u30c8\u30e2\u30fc\u30c9 or \u30c0\u30fc\u30af\u30e2\u30fc\u30c9\u300d\u304c\u9078\u629e\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h2>update()<\/h2>\n<p>\u3053\u3053\u306f\u3001<code>edit()<\/code>\u3067\u9078\u629e\u3055\u308c\u305f\u30d7\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u304c\u9001\u4fe1\u3055\u308c\u3066\u6765\u3066\u3001\u5b9f\u969b\u306b\u4fdd\u5b58\u3059\u308b\u5834\u6240\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3053\u3053\u3082\u30ed\u30b0\u30a4\u30f3\u306e\u6709\u7121\u3067\u5206\u5c90\u3057\u3001<code>DB<\/code>\u3068<code>Cookie<\/code>\u3078\u305d\u308c\u305e\u308c\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u306f\u30eb\u30fc\u30c8\u3067\u3059\u3002<br \/>\n\u5148\u307b\u3069\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u4f5c\u6210\u3057\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u767b\u9332\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\n<strong>use App\\Http\\Controllers\\PreferenceController;\r\n\r\nRoute::post('\/preferences', [PreferenceController::class, 'index'])-&gt;name('preferences.index');\r\nRoute::get('\/preferences\/edit', [PreferenceController::class, 'edit'])-&gt;name('preferences.edit');\r\nRoute::put('\/preferences', [PreferenceController::class, 'update'])-&gt;name('preferences.update');<\/strong><\/pre>\n<h1>\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u305f\u3089 Cookie \u5185\u306e\u30c7\u30fc\u30bf\u3092DB\u3078\u79fb\u884c\u3059\u308b\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u305f\u3068\u304d\u306b\u30c7\u30fc\u30bf\u79fb\u884c\u3059\u308b\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u76f4\u63a5\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u3001\u305b\u3063\u304b\u304f<code>Registered<\/code>\u30a4\u30d9\u30f3\u30c8\u304c\u3042\u308b\u306e\u3067\u3001\u305d\u3053\u306b\u5c02\u7528\u30ea\u30b9\u30ca\u30fc\u3092\u30bb\u30c3\u30c8\u3057\u3066\u52d5\u304f\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan make:listener StorePreferencesFromCookie<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30a4\u30d9\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u6b21\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Listeners\/StorePreferencesFromCookie.php<\/strong><\/p>\n<pre><strong>&lt;?php\r\n\r\nnamespace App\\Listeners;\r\n\r\nuse App\\Models\\Preference;\r\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\r\nuse Illuminate\\Queue\\InteractsWithQueue;\r\nuse Illuminate\\Support\\Facades\\Cookie;\r\nuse Illuminate\\Support\\Str;\r\n\r\nclass StorePreferencesFromCookie\r\n{\r\n    \/**\r\n     * Create the event listener.\r\n     *\/\r\n    public function __construct()\r\n    {\r\n        \/\/\r\n    }\r\n\r\n    \/**\r\n     * Handle the event.\r\n     *\/\r\n    public function handle(object $event): void\r\n    {\r\n        $all_cookies = Cookie::get();\r\n        $cookie_preferences = array_filter($all_cookies, function ($key) {\r\n\r\n            return Str::startsWith($key, 'preferences:');\r\n\r\n        }, ARRAY_FILTER_USE_KEY);\r\n\r\n        if (count($cookie_preferences) &gt; 0) {\r\n\r\n            $preferences = [];\r\n            $now = now();\r\n\r\n            foreach ($cookie_preferences as $key =&gt; $value) {\r\n\r\n                $original_key = str_replace('preferences:', '', $key);\r\n                Cookie::queue(Cookie::forget($key)); \/\/ Cookie \u3092\u524a\u9664\r\n\r\n                $preferences[] = [\r\n                    'user_id' =&gt; $event-&gt;user-&gt;id,\r\n                    'key' =&gt; $original_key,\r\n                    'value' =&gt; $value,\r\n                    'created_at' =&gt; $now,\r\n                    'updated_at' =&gt; $now,\r\n                ];\r\n\r\n            }\r\n\r\n            Preference::insert($preferences);\r\n\r\n        }\r\n    }\r\n}<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>Cookie\u30c7\u30fc\u30bf\u306e\u4e2d\u304b\u3089\u3001\u300cpreferences:\u300d\u3067\u59cb\u307e\u308b\u3082\u306e\u3060\u3051\u3092\u53d6\u5f97<\/li>\n<li>\u305d\u306e\u30c7\u30fc\u30bf\u3092\u30eb\u30fc\u30d7\u3057\u3001key \u3068 value \u3092 DB \u3078\u4fdd\u5b58<\/li>\n<li>\u540c\u6642\u306b\u3082\u3046 Cookie \u306f\u4e0d\u8981\u306a\u306e\u3067\u3001\u524a\u9664<\/li>\n<\/ol>\n<p>\u306a\u304a\u3001<code>Cookie<\/code>\u306e\u524a\u9664\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001<code>forget<\/code>\u3092<code>queue<\/code>\u3078\u30bb\u30c3\u30c8\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\uff08\u6700\u521d\u3001<code>Cookie::forget($key);<\/code>\u5358\u4f53\u3067\u3046\u307e\u304f\u3044\u304b\u305a\u5c11\u3057\u30cf\u30de\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u2026\ud83d\ude2b\uff09<\/p>\n<pre><strong>Cookie::queue(Cookie::forget($key)); \/\/ \ud83d\udc48 \u3053\u3046\u3059\u308b<\/strong><\/pre>\n<p>\u306a\u304a\u3001\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u306f\u4f5c\u6210\u3057\u305f\u3060\u3051\u3067\u306f\u5b9f\u884c\u3067\u304d\u307e\u305b\u3093\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Providers\/EventServiceProvider.php<\/strong><\/p>\n<pre><strong>use App\\Listeners\\StorePreferencesFromCookie;<\/strong>\r\n\r\n\/\/ \u7701\u7565\r\n\r\nprotected $listen = [\r\n    Registered::class =&gt; [\r\n        SendEmailVerificationNotification::class,\r\n        <strong>StorePreferencesFromCookie::class,<\/strong> \/\/ \ud83d\udc48\u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\r\n    ],\r\n];<\/pre>\n<h1>React \u90e8\u5206\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u30d3\u30e5\u30fc\u3068\u306a\u308b<code>React<\/code>\u90e8\u5206\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>resources\/js\/Pages\/Preferences\/Edit.jsx<\/strong><\/p>\n<pre><strong>import React, {useEffect, useState} from 'react';\r\n\r\nexport default function Preferences() {\r\n\r\n    \/\/ \u5165\u529b\r\n    const [preferences, setPreferences] = useState({\r\n        theme: '',\r\n    });\r\n    const getPreferences = () =&gt; {\r\n\r\n        const url = route('preferences.index');\r\n        const params = {\r\n            keys: Object.keys(preferences),\r\n        };\r\n\r\n        axios.post(url, params)\r\n            .then(response =&gt; {\r\n\r\n                setPreferences(response.data);\r\n\r\n            });\r\n\r\n    };\r\n    useEffect(() =&gt; {\r\n\r\n        getPreferences();\r\n\r\n    }, []);\r\n\r\n    \/\/ \u56fa\u5b9a\u30c7\u30fc\u30bf\r\n    const themes = [\r\n        { value: 'light', label: '\u30e9\u30a4\u30c8\u30e2\u30fc\u30c9' },\r\n        { value: 'dark', label: '\u30c0\u30fc\u30af\u30e2\u30fc\u30c9' },\r\n    ];\r\n\r\n    \/\/ \u30a4\u30d9\u30f3\u30c8\r\n    const handleInputChange = (e) =&gt; {\r\n\r\n        const { name, value } = e.target;\r\n        setPreferences({ ...preferences, [name]: value });\r\n\r\n    };\r\n    const handleSubmit = () =&gt; {\r\n\r\n        if(confirm('\u30d7\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u4fdd\u5b58\u3057\u307e\u3059\u3002\u3088\u308d\u3057\u3044\u3067\u3059\u304b\uff1f')) {\r\n\r\n            const url = route('preferences.update');\r\n            const params = {\r\n                _method: 'PUT',\r\n                preferences: preferences,\r\n            };\r\n\r\n            axios.post(url, params)\r\n                .then(response =&gt; {\r\n\r\n                    setPreferences(response.data);\r\n                    getPreferences();\r\n\r\n                });\r\n\r\n        }\r\n\r\n    };\r\n\r\n    return (\r\n        &lt;div className=\"min-h-screen bg-gray-100 py-6 flex flex-col justify-center sm:py-12\"&gt;\r\n            &lt;div className=\"relative py-3 sm:max-w-xl sm:mx-auto\"&gt;\r\n                &lt;div className=\"w-80 relative px-4 py-10 bg-white mx-8 md:mx-0 shadow rounded-2xl sm:p-10\"&gt;\r\n                    &lt;h1 className=\"text-center text-xl font-semibold mb-4\"&gt;\u30d7\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9&lt;\/h1&gt;\r\n                    &lt;div className=\"flex items-center mb-5\"&gt;\r\n                        &lt;label htmlFor=\"darkmode\" className=\"w-32 font-semibold text-gray-700\"&gt;\u30c6\u30fc\u30de:&lt;\/label&gt;\r\n                        &lt;select\r\n                            id=\"theme\"\r\n                            name=\"theme\"\r\n                            value={preferences.theme}\r\n                            onChange={handleInputChange}\r\n                            className=\"block mt-1 w-full p-2 rounded border-gray-300 focus:ring focus:ring-offset-0\"\r\n                        &gt;\r\n                            {themes.map((theme) =&gt; (\r\n                                &lt;option key={theme.value} value={theme.value}&gt;\r\n                                    {theme.label}\r\n                                &lt;\/option&gt;\r\n                            ))}\r\n                        &lt;\/select&gt;\r\n                    &lt;\/div&gt;\r\n                    &lt;button\r\n                        type=\"button\"\r\n                        className=\"w-full flex justify-center items-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500\"\r\n                        onClick={handleSubmit}\r\n                    &gt;\r\n                        \u4fdd\u5b58\u3059\u308b\r\n                    &lt;\/button&gt;\r\n                &lt;\/div&gt;\r\n            &lt;\/div&gt;\r\n        &lt;\/div&gt;\r\n    );\r\n\r\n};\r\n<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u306f\u30c7\u30fc\u30bf\u3092\u9078\u629e\u3057\u3001\u4fdd\u5b58\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u7279\u5225\u306a\u30b3\u30fc\u30c9\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\uff08\u4eca\u66f4\u306a\u304c\u3089\u77e5\u3063\u305f\uff09<code>useState<\/code>\u3092\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u7ba1\u7406\u3057\u3001\u305d\u306e\u4e2d\u8eab\u3092\u30bb\u30c3\u30c8\u3059\u308b\u4ee5\u4e0b\u306e\u90e8\u5206\u304c\u6c17\u306b\u5165\u3063\u3066\u3044\u307e\u3059\u3002\uff08\u3053\u306e\u66f8\u304d\u65b9\u3001\u30b9\u30bf\u30a4\u30ea\u30c3\u30b7\u30e5\u3067\u3059\u306d\ud83d\ude04\uff09<\/p>\n<pre><strong>setPreferences({ ...preferences, [name]: value });<\/strong><\/pre>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<p>\u307e\u305a<code>vite<\/code>\u3092\u8d77\u52d5\u3057\u3066\u3001\u300c<strong>https:\/\/******\/preferences\/edit<\/strong>\u300d\u3078\u30d6\u30e9\u30a6\u30b6\u3067\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002\uff08\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30c6\u30fc\u30de\u3092\u9078\u629e\u3059\u308b\u30bb\u30ec\u30af\u30c8\u30dc\u30c3\u30af\u30b9\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11629\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_2.png\" alt=\"\" width=\"353\" height=\"263\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_2.png 353w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_2-300x224.png 300w\" sizes=\"auto, (max-width: 353px) 100vw, 353px\" \/><\/p>\n<p>\u3053\u308c\u3092\u300c<strong>\u30c0\u30fc\u30af\u30e2\u30fc\u30c9<\/strong>\u300d\u306b\u5909\u66f4\u3057\u3066\u4fdd\u5b58\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11630\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_3.png\" alt=\"\" width=\"357\" height=\"263\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_3.png 357w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_3-300x221.png 300w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\uff08\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\u306e\u3067\uff09<code>Cookie<\/code>\u306e\u4e2d\u306b\u30c7\u30fc\u30bf\u304c\u683c\u7d0d\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11631\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_4.png\" alt=\"\" width=\"531\" height=\"153\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_4.png 531w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_4-300x86.png 300w\" sizes=\"auto, (max-width: 531px) 100vw, 531px\" \/><\/p>\n<p>\u3082\u3061\u308d\u3093\u3001\u307e\u3060\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u306f\u4f55\u3082\u4fdd\u5b58\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11632\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_5.png\" alt=\"\" width=\"426\" height=\"256\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_5.png 426w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_5-300x180.png 300w\" sizes=\"auto, (max-width: 426px) 100vw, 426px\" \/><\/p>\n<p>\u3067\u306f\u3001\u767b\u9332\u3059\u308b\u524d\u306b\u30da\u30fc\u30b8\u3092\u30ea\u30ed\u30fc\u30c9\u3057\u3066\u300c<strong>\u30c0\u30fc\u30af\u30e2\u30fc\u30c9<\/strong>\u300d\u304c<code>Cookie<\/code>\u306b\u3088\u3063\u3066\u30ad\u30fc\u30d7\u3067\u304d\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11633\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_6.png\" alt=\"\" width=\"399\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_6.png 399w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_6-300x241.png 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u3061\u3087\u3063\u3068\u308f\u304b\u308a\u306b\u304f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u3046\u307e\u304f\u30ad\u30fc\u30d7\u3067\u304d\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3092\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11634\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_7.png\" alt=\"\" width=\"483\" height=\"424\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_7.png 483w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_7-300x263.png 300w\" sizes=\"auto, (max-width: 483px) 100vw, 483px\" \/><\/p>\n<p>\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p>\u307e\u305a\u306f<code>DB<\/code>\u306e\u65b9\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11635\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_8.png\" alt=\"\" width=\"539\" height=\"345\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_8.png 539w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_8-300x192.png 300w\" sizes=\"auto, (max-width: 539px) 100vw, 539px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u5148\u307b\u3069<code>Cookie<\/code>\u306b\u30bb\u30c3\u30c8\u3057\u305f<code>dark<\/code>\u3068\u3044\u3046\u5024\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e0d\u8981\u306b\u306a\u3063\u305f<code>Cookie<\/code>\u304c\u524a\u9664\u3055\u308c\u3066\u3044\u308b\u304b\u3082\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11636\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_9.png\" alt=\"\" width=\"531\" height=\"153\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_9.png 531w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_9-300x86.png 300w\" sizes=\"auto, (max-width: 531px) 100vw, 531px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u6d88\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u5148\u307b\u3069\u306e\u30da\u30fc\u30b8\u306b\u623b\u3063\u3066\u300c<strong>\u30c0\u30fc\u30af\u30e2\u30fc\u30c9<\/strong>\u300d\u304c\u30ad\u30fc\u30d7\u3055\u308c\u3066\u3044\u308b\u304b\uff08Cookie\u3092\u4f7f\u308f\u305aDB\u304b\u3089\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u3066\u3044\u308b\u304b\uff09\u3092\u78ba\u8a8d\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11637\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_10.png\" alt=\"\" width=\"356\" height=\"265\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_10.png 356w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_prefercent_without_login_10-300x223.png 300w\" sizes=\"auto, (max-width: 356px) 100vw, 356px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u540c\u3058\u304f\u898b\u305f\u76ee\u306f\u540c\u3058\u3067\u3059\u304c\uff08DB\u304b\u3089\u30c7\u30fc\u30bf\u53d6\u5f97\u3067\u304d\u3066\uff09\u300c<strong>\u30c0\u30fc\u30af\u30e2\u30fc\u30c9<\/strong>\u300d\u304c\u30ad\u30fc\u30d7\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3059\u3079\u3066\u6210\u529f\u3067\u3059\ud83d\ude04\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u56de\u306e\u6a5f\u80fd\u3092\u4f7f\u3048\u3070\u3001\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3092\u305f\u3081\u3089\u3063\u3066\u3044\u308b\u3051\u308c\u3069\u3082\u30b5\u30a4\u30c8\u306b\u8208\u5473\u3092\u3082\u3063\u3066\u3044\u308b\u4eba\u304c\u304a\u8a66\u3057\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u3001\u7d50\u679c\u3068\u3057\u3066\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3078\u3064\u306a\u3052\u308b\u3088\u3046\u30a2\u30d7\u30ed\u30fc\u30c1\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001<code>Cookie<\/code>\u3060\u3051\u3067\u3082\u30b5\u30a4\u30c8\u3092\u4f7f\u3048\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u6709\u52b9\u671f\u9650\u30921\u30f6\u6708\u306b\u3057\u3066\u5f37\u5236\u7684\u306b\u30c7\u30fc\u30bf\u304c\u524a\u9664\u3055\u308c\u308b\u3088\u3046\u306b\u3059\u308b\u3001\u3082\u3057\u304f\u306fPC\u30fb\u30b9\u30de\u30db\u9593\u3067\u540c\u3058\u30c7\u30fc\u30bf\u304c\u4f7f\u3046\u305f\u3081\u306b\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u304c\u5fc5\u8981\u306a\u3053\u3068\u3092\u77e5\u3089\u305b\u308b\u3053\u3068\u3067\u3088\u308a\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306e\u6570\u3092\u5897\u3084\u305b\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3082\u3057\u305d\u3046\u3044\u3063\u305f\u6a5f\u80fd\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u3001\u305c\u3072\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude04\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u300c<strong>Laravel 10.x \uff0b React<\/strong>\u300d\u3067\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306f\u30b7\u30f3\u30d7\u30eb\u306b\u306f\u3044\u304b\u306a\u3044\u306e\u3067\u3001\u3044\u308d\u3044\u308d\u3068\u4f5c\u6226\u304c\u5fc5\u8981\u306b\u306a\u3063\u3066\u304f\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u500b\u4eba\u7684\u306b\u306f\u307e\u3060\u307e\u3060\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u306e\u77e5\u8b58\u306f\u4e0d\u8db3\u3057\u3066\u3044\u308b\u306e\u3067\u3001<code>ChatGPT 4<\/code>\u3067\u5c11\u3057\u3067\u3082\u88dc\u3044\u306a\u304c\u3089\u4f5c\u696d\u3092\u9032\u3081\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u306f\u3044\u3048\u3001\u77e5\u8b58\u304c\u30bc\u30ed\u306e\u79c1\u306b\u3068\u3063\u3066\u306f<code>ChatGPT<\/code>\u306f\u5f37\u529b\u3059\u304e\u308b\u52a9\u3063\u4eba\u306a\u306e\u3067\u3068\u3066\u3082\u52a9\u304b\u308a\u307e\u3059\u306d\u3002\uff08\u7279\u306b\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u3068\u30c7\u30b6\u30a4\u30f3\uff09<\/p>\n<p>\u3057\u304b\u3057\u3001\u9006\u306b\u672c\u696d\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u306a\u308b\u3068\u3001\u300c\u3044\u3084\u3001\u305d\u3053\u306f\u305d\u3046\u3058\u3083\u306a\u3044\u3067\u3057\u3087\u2026\u300d\u3068\u306a\u308b\u90e8\u5206\u3082\u591a\u3044\u3053\u3068\u3092\u8003\u3048\u308b\u3068\u3001\u30de\u30fc\u30b1\u30c6\u30a3\u30f3\u30b0\u3084\u30c7\u30b6\u30a4\u30f3\u306b\u3082\u305d\u3046\u3044\u3046\u3063\u305f\u90e8\u5206\u304c\u5c11\u306a\u304b\u3089\u305a\u542b\u307e\u308c\u3066\u3044\u3066\u3001\u77e5\u8b58\u304c\u306a\u3044\u306e\u3067\u305d\u308c\u3092\u898b\u9003\u3057\u3066\u3044\u308b\u3068\u3044\u3046\u72b6\u6cc1\u3068\u8a00\u3063\u3066\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u308c\u304b\u3089\u3082\u7cbe\u9032\u304c\u5fc5\u8981\u3067\u3059\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3344 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22.png\" alt=\"\" width=\"320\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22.png 320w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22-150x150.png 150w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22-300x300.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22-100x100.png 100w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/>\u300c\u30ab\u30ca\u30c0\u306e\u53cb\u4eba\u3082<br \/>\n\u30d7\u30ed\u30b0\u30e9\u30de\u306a\u306e\u3067\u3059\u304c\u3001<br \/>\nChatGPT\u306b\u3064\u3044\u3066\u540c\u610f\u898b\u3067\u3057\u305f\ud83d\udc4d\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u306f\u6642\u9593\u3092\u898b\u3064\u3051\u3066\u500b\u4eba\u7684\u306b\u30b5\u30a4\u30c8\u3092\u4f5c\u3063\u3066\u3044\u307e\u3059\u3002 \u305d\u3057\u3066\u3001\u305d\u306e\u7d4c\u9a13\u306e\u4e2d\u30db\u30f3\u30c8\u306b\u96e3\u3057\u3044\u3068\u611f\u3058\u3066\u3044\u308b\u306e\u304c\u3001 \u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u3066\u3082\u3089\u3046\u3053\u3068 \u3067\u3059\u3002 \u3082\u3061\u308d\u3093\u30de &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=11621\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010Laravel 10.x\u3011\u30ed\u30b0\u30a4\u30f3\u306a\u3057\u3067\u3082\u30c7\u30fc\u30bf\u4fdd\u6301\u3067\u304d\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u305f\u3089DB\u3078\u79fb\u884c\u3059\u308b\u6a5f\u80fd&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":11640,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,118],"tags":[],"class_list":["post-11621","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-react-js"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11621"}],"version-history":[{"count":8,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11621\/revisions"}],"predecessor-version":[{"id":11639,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11621\/revisions\/11639"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/11640"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}