{"id":10860,"date":"2022-09-05T07:00:57","date_gmt":"2022-09-04T22:00:57","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=10860"},"modified":"2023-03-12T07:00:14","modified_gmt":"2023-03-11T22:00:14","slug":"%e3%80%90laravel%e3%80%91vite-inertia-react-%e3%81%a7%e3%80%8c%e8%bf%bd%e5%8a%a0%e3%83%bb%e5%a4%89%e6%9b%b4%e3%83%bb%e5%89%8a%e9%99%a4%e3%83%bb%e9%96%b2%e8%a6%a7%e3%80%8d%e6%a9%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=10860","title":{"rendered":"\u3010Laravel\u3011Vite + Inertia + React \u3067\u300c\u8ffd\u52a0\u30fb\u5909\u66f4\u30fb\u524a\u9664\u30fb\u95b2\u89a7\u300d\u6a5f\u80fd\u3092\u3064\u304f\u308b\uff08CRUD\uff09"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u300c<strong>Vite + Inertia + React<\/strong>\u300d\u3067\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u3082\u305d\u306e\u6d41\u308c\u3067\u57fa\u672c\u7684\u306a\u300c<strong>\u8ffd\u52a0\u30fb\u5909\u66f4\u30fb\u524a\u9664\u30fb\u95b2\u89a7<\/strong>\u300d\u90e8\u5206\uff08\u3044\u308f\u3086\u308b <code>CRUD<\/code>\uff09\u3092\u3064\u304f\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001\u3067\u304d\u308b\u3060\u3051\u30b3\u30f3\u30d1\u30af\u30c8\u306b\u3057\u305f\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u6c17\u304c\u3064\u3051\u3070\uff11\u4e07\u6587\u5b57\u3092\u5927\u304d\u304f\u8d85\u3048\u308b\u30dc\u30ea\u30e5\u30fc\u30e0\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u300c<strong>\uff12\u56de\u306b\u5206\u5272\u3057\u305f\u65b9\u304c\u3088\u304b\u3063\u305f\u306e\u3067\u306f\u2026<\/strong>\u300d\u3068\u601d\u3063\u305f\u308a\u3082\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u300c<strong>\u6280\u8853\u7cfb\u30d6\u30ed\u30b0\u754c\u306e\u3053\u3061\u4e80<\/strong>\u300d\u306e\u3088\u3046\u306a\u3001<strong>\u3044\u3064\u8aad\u307f\u59cb\u3081\u3066\u3082\u697d\u3057\u3081\u308b\uff08\u3067\u304d\u308b\u3060\u3051\u7d9a\u304d\u3082\u306e\u306b\u306f\u3057\u306a\u3044\uff09\u30b9\u30bf\u30f3\u30b9<\/strong>\u3067\u30d6\u30ed\u30b0\u904b\u55b6\u3092\u3057\u3066\u3044\u308b\u3053\u3068\u3082\u3042\u308a\u3001\u3042\u3048\u3066\uff11\u56de\u3067\u516c\u958b\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\uff08\u7b11\uff09<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f\u300c<strong>Laravel + Vite + Inertia + React<\/strong>\u300d\u3067\u300c<strong>\u8ffd\u52a0\u30fb\u5909\u66f4\u30fb\u524a\u9664\u30fb\u95b2\u89a7<\/strong>\u300d\u6a5f\u80fd\u3092\u3064\u304f\u3063\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\ud83d\ude0a\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u4eba\u751f\u3067\u521d\u3081\u3066<br \/>\n\u30eb\u30fb\u30d7\u30c6\u30a3\u30fb\u30e0\u30fc\u30c8\u30f3\u3068\u3044\u3046<br \/>\n\u9ad8\u7d1a\u30ef\u30a4\u30f3\u3092\u98f2\u307f\u307e\u3057\u305f\ud83c\udf77\u2728<br \/>\n\uff08\u305f\u3060\u3057\u3001\u81ea\u5206\u3067\u306f\u8cb7\u3063\u3066\u306a\u3044\u3067\u3059\uff09\u300d<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 9.x\u3001Vite\u3001Inertia\u3001ReactJS<\/p>\n<h1>\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f<code>Laravel<\/code>\u5074\u3067\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u4e00\u6c17\u306b\u300c<strong>\u30e2\u30c7\u30eb<\/strong>\u300d\u300c<strong>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3<\/strong>\u300d\u300c<strong>Seeder\uff08\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u4f5c\u6210\uff09<\/strong>\u300d\u300c<strong>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc<\/strong>\u300d\u3092\u7528\u610f\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>php artisan make:model Post -msc<\/strong><\/pre>\n<p>\u3067\u306f\u3001\u305d\u308c\u305e\u308c\u4f5c\u6210\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u3092\u5909\u66f4\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3<\/h2>\n<p>\u307e\u305a\u306f<code>DB<\/code>\u306e\u8a2d\u8a08\u56f3\u306b\u306a\u308b\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_posts_table.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up()\r\n{\r\n    <strong>Schema::create('posts', function (Blueprint $table) {<\/strong>\r\n<strong>        $table-&gt;id();<\/strong>\r\n<strong>        $table-&gt;string('title')-&gt;comment('\u30bf\u30a4\u30c8\u30eb');<\/strong>\r\n<strong>        $table-&gt;text('body')-&gt;comment('\u672c\u6587');<\/strong>\r\n<strong>        $table-&gt;timestamps();<\/strong>\r\n<strong>    });<\/strong>\r\n}\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<h2>Seeder<\/h2>\n<p>\u6b21\u306b\u3001<code>DB<\/code>\u306b\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u7528\u610f\u3067\u304d\u308b<code>Seeder<\/code>\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002<\/p>\n<p><strong>database\/seeders\/PostSeeder.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\nclass PostSeeder extends Seeder\r\n{\r\n    \/\/ \u7701\u7565\r\n\r\n    <strong>public function run()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        for($i = 0; $i &lt; 25; $i++) {<\/strong>\r\n\r\n<strong>            Post::create([<\/strong>\r\n<strong>                'title' =&gt; '\u30bf\u30a4\u30c8\u30eb' . $i,<\/strong>\r\n<strong>                'body' =&gt; '\u672c\u6587' . $i,<\/strong>\r\n<strong>            ]);<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p>\u306a\u304a\u3001<code>Seeder<\/code>\u306f\u4f5c\u6210\u3057\u305f\u3060\u3051\u3067\u306f\u6709\u52b9\u306b\u306a\u308a\u307e\u305b\u3093\u306e\u3067\u3001<code>DatabaseSeeder.php<\/code>\u3078\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<p><strong>database\/seeders\/DatabaseSeeder.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\nclass DatabaseSeeder extends Seeder\r\n{\r\n    \/\/ \u7701\u7565\r\n\r\n    public function run()\r\n    {\r\n        \/\/ \u7701\u7565\r\n\r\n        <strong>$this-&gt;call(PostSeeder::class);<\/strong> \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\r\n    }\r\n}<\/pre>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067DB\u3092\u521d\u671f\u5316\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\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<code>posts<\/code>\u30c6\u30fc\u30d6\u30eb\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10862\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_1.png\" alt=\"\" width=\"475\" height=\"373\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_1.png 475w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_1-300x236.png 300w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/p>\n<h2>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc<\/h2>\n<p>\u305d\u3057\u3066\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u3059\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/PostController.php<\/strong><\/p>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Http\\Controllers;<\/strong>\r\n<strong>use App\\Http\\Requests\\PostRequest;<\/strong>\r\n<strong>use App\\Models\\Post;<\/strong>\r\n<strong>use Inertia\\Inertia;<\/strong>\r\n\r\n<strong>use Illuminate\\Http\\Request;<\/strong>\r\n\r\n<strong>class PostController extends Controller<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    public function index()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $posts = Post::paginate(5);<\/strong>\r\n\r\n<strong>        return Inertia::render('Post\/Index', [<\/strong>\r\n<strong>            'title' =&gt; 'Laravel\uff1a Vite + Inertia + React \u3067 CRUD \u30b5\u30f3\u30d7\u30eb',<\/strong>\r\n<strong>            'posts' =&gt; $posts,<\/strong>\r\n<strong>            'message' =&gt; session('message'),<\/strong>\r\n<strong>        ]);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function create()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return Inertia::render('Post\/Create');<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function store(PostRequest $request)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $post = new Post();<\/strong>\r\n<strong>        $post-&gt;title = $request-&gt;title;<\/strong>\r\n<strong>        $post-&gt;body = $request-&gt;body;<\/strong>\r\n<strong>        $post-&gt;save();<\/strong>\r\n\r\n<strong>        return redirect()-&gt;route('post.index')-&gt;with([<\/strong>\r\n<strong>            'message' =&gt; '\u767b\u9332\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f',<\/strong>\r\n<strong>        ]);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function show(Post $post)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return Inertia::render('Post\/Show', [<\/strong>\r\n<strong>            'post' =&gt; $post,<\/strong>\r\n<strong>        ]);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function edit(Post $post)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return Inertia::render('Post\/Edit', [<\/strong>\r\n<strong>            'post' =&gt; $post,<\/strong>\r\n<strong>        ]);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function update(PostRequest $request, Post $post)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $post-&gt;title = $request-&gt;title;<\/strong>\r\n<strong>        $post-&gt;body = $request-&gt;body;<\/strong>\r\n<strong>        $post-&gt;save();<\/strong>\r\n\r\n<strong>        return redirect()-&gt;route('post.index')-&gt;with([<\/strong>\r\n<strong>            'message' =&gt; '\u5909\u66f4\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f',<\/strong>\r\n<strong>        ]);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function destroy(Request $request, Post $post)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $post-&gt;delete();<\/strong>\r\n\r\n<strong>        \/\/ \u30da\u30fc\u30b8\u756a\u53f7\u3064\u304d\u3067\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\uff08\u524a\u9664\u6642\u306b\u30da\u30fc\u30b8\u79fb\u52d5\u3057\u3066\u3057\u307e\u308f\u306a\u3044\u305f\u3081\uff09<\/strong>\r\n<strong>        return redirect()<\/strong>\r\n<strong>            -&gt;route('post.index', ['page' =&gt; $request-&gt;page])<\/strong>\r\n<strong>            -&gt;with('message', '\u524a\u9664\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f');<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u30b3\u30fc\u30c9\u306f\u5c11\u3057\u9577\u3044\u3082\u306e\u306e\u3001\u901a\u5e38\u306e<code>CRUD<\/code>\u3068\u307b\u307c\u540c\u3058\u3067\u3059\u3002<\/p>\n<p>\u9055\u3046\u90e8\u5206\u3068\u3044\u3048\u3070\u3001<code>Inertia::render()<\/code>\u306e\u90e8\u5206\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001<code>Inertia<\/code>\u7528\u306e\u30c7\u30fc\u30bf\u3092\u7528\u610f\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3001\u5f8c\u3067\u3064\u304f\u308b\u3053\u3068\u306b\u306a\u308b<code>resources\/js\/Pages<\/code>\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u30d3\u30e5\u30fc\uff08\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\uff09\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/h1>\n<p>\u5148\u307b\u3069\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5185\u3067\u30bb\u30c3\u30c8\u3057\u305f<code>PostRequest<\/code>\u304c\u3001\u307e\u3060\u5b58\u5728\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u3053\u3053\u3067\u3064\u304f\u3063\u3066\u3044\u304d\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:request PostRequest<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Requests\/PostRequest.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\nclass PostRequest extends FormRequest\r\n{\r\n    public function authorize()\r\n    {\r\n        <strong>return true;<\/strong>\r\n    }\r\n\r\n    public function rules()\r\n    {\r\n        <strong>return [<\/strong>\r\n<strong>            'title' =&gt; 'required|string|max:255',<\/strong>\r\n<strong>            'body' =&gt; 'required|string|max:255',<\/strong>\r\n<strong>        ];<\/strong>\r\n    }\r\n}<\/pre>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2023.03.12\u3011<\/strong>\u8a2a\u554f\u8005\u3055\u3093\u304b\u3089\u306e\u3054\u8cea\u554f\u3092\u3044\u305f\u3060\u3044\u305f\u306e\u3067\u3001\u30b3\u30fc\u30c9\u3092\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001<code>PostController<\/code>\u5185\u306e<code>store()<\/code>\u3068<code>edit()<\/code>\u3067\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\uff08\u5165\u529b\u30c1\u30a7\u30c3\u30af\uff09\u304c\u6709\u52b9\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h1>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u898b\u308b\u3053\u3068\u306b\u306a\u308b\u30d3\u30e5\u30fc\uff08\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\uff09\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4f5c\u6210\u3059\u308b\u30da\u30fc\u30b8\u306f\u4ee5\u4e0b\u306e\uff14\u3064\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u4e00\u89a7\uff1a index<\/li>\n<li>\u500b\u5225\u8868\u793a\uff1a show<\/li>\n<li>\u30c7\u30fc\u30bf\u8ffd\u52a0\uff1a create<\/li>\n<li>\u30c7\u30fc\u30bf\u5909\u66f4\uff1a edit<\/li>\n<\/ul>\n<p>\u3067\u306f\u3001\u9806\u306b\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>index<\/h2>\n<p><strong>resources\/js\/Pages\/Post\/Index.jsx<\/strong><\/p>\n<pre><strong>import React from \"react\";<\/strong>\r\n<strong>import { Inertia } from \"@inertiajs\/inertia\";<\/strong>\r\n<strong>import { Link } from '@inertiajs\/inertia-react';<\/strong>\r\n<strong>import Pagination from \"@\/Components\/Pagination\";<\/strong>\r\n\r\n<strong>export default function Index(props) {<\/strong>\r\n\r\n<strong>    \/\/ Data<\/strong>\r\n<strong>    const { message } = props;<\/strong>\r\n\r\n<strong>    \/\/ Methods<\/strong>\r\n<strong>    const onDelete = id =&gt; {<\/strong>\r\n\r\n<strong>        if(confirm('\u524a\u9664\u3057\u307e\u3059\u3002\u3088\u308d\u3057\u3044\u3067\u3059\u304b\uff1f')) {<\/strong>\r\n\r\n<strong>            const url = route('post.destroy', id);<\/strong>\r\n<strong>            const params = {<\/strong>\r\n<strong>                _method: 'delete',<\/strong>\r\n<strong>                page: props.posts.current_page<\/strong>\r\n<strong>            };<\/strong>\r\n\r\n<strong>            \/\/ delete() \u3067\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u9001\u4fe1\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u3042\u3048\u3066 post() \u3092\u4f7f\u3063\u3066\u3044\u307e\u3059<\/strong>\r\n<strong>            Inertia.post(url, params);<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>    };<\/strong>\r\n\r\n<strong>    return (<\/strong>\r\n<strong>        &lt;div className=\"p-5\"&gt;<\/strong>\r\n<strong>            &lt;h1 className=\"font-bold\"&gt;{props.title}&lt;\/h1&gt;<\/strong>\r\n<strong>            {message &amp;&amp; &lt;div id=\"message\" className=\"mt-2 text-green-700  bg-green-100 p-3 rounded-lg\"&gt;{message}&lt;\/div&gt;}<\/strong>\r\n<strong>            &lt;div className=\"text-right p-3 mb-2\"&gt;<\/strong>\r\n<strong>                &lt;Link className=\"text-white bg-green-700 rounded-lg text-sm px-4 py-2 mr-2\" href={route('post.create')}&gt;+ \u8ffd\u52a0\u3059\u308b&lt;\/Link&gt;<\/strong>\r\n<strong>            &lt;\/div&gt;<\/strong>\r\n<strong>            &lt;table className=\"w-full bg-gray-100\"&gt;<\/strong>\r\n<strong>                &lt;thead className=\"bg-blue-100\"&gt;<\/strong>\r\n<strong>                    &lt;tr&gt;<\/strong>\r\n<strong>                        &lt;th&gt;ID&lt;\/th&gt;<\/strong>\r\n<strong>                        &lt;th&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/th&gt;<\/strong>\r\n<strong>                        &lt;th&gt;\u64cd\u4f5c&lt;\/th&gt;<\/strong>\r\n<strong>                    &lt;\/tr&gt;<\/strong>\r\n<strong>                &lt;\/thead&gt;<\/strong>\r\n<strong>                &lt;tbody&gt;<\/strong>\r\n<strong>                    {props.posts.data.map(post =&gt; (<\/strong>\r\n<strong>                        &lt;tr key={post.id}&gt;<\/strong>\r\n<strong>                            &lt;td className=\"p-2 border\"&gt;{post.title}&lt;\/td&gt;<\/strong>\r\n<strong>                            &lt;td className=\"p-2 border\"&gt;{post.body}&lt;\/td&gt;<\/strong>\r\n<strong>                            &lt;td className=\"p-2 border\"&gt;<\/strong>\r\n<strong>                                &lt;Link<\/strong>\r\n<strong>                                    className=\"text-white bg-gray-400 rounded-lg text-sm px-4 py-2 mr-2\"<\/strong>\r\n<strong>                                    href={route('post.show', { id: post.id })}&gt;<\/strong>\r\n<strong>                                    \u78ba\u8a8d<\/strong>\r\n<strong>                                &lt;\/Link&gt;<\/strong>\r\n<strong>                                &lt;Link<\/strong>\r\n<strong>                                    className=\"text-white bg-blue-700 rounded-lg text-sm px-4 py-2 mr-2\"<\/strong>\r\n<strong>                                    href={route('post.edit', { id: post.id })}&gt;<\/strong>\r\n<strong>                                    \u5909\u66f4<\/strong>\r\n<strong>                                &lt;\/Link&gt;<\/strong>\r\n<strong>                                &lt;button<\/strong>\r\n<strong>                                    className=\"text-white bg-red-700 rounded-lg text-sm px-4 py-2 mr-2\"<\/strong>\r\n<strong>                                    onClick={() =&gt; onDelete(post.id)}&gt;<\/strong>\r\n<strong>                                    \u524a\u9664<\/strong>\r\n<strong>                                &lt;\/button&gt;<\/strong>\r\n<strong>                            &lt;\/td&gt;<\/strong>\r\n<strong>                        &lt;\/tr&gt;<\/strong>\r\n<strong>                    ))}<\/strong>\r\n<strong>                &lt;\/tbody&gt;<\/strong>\r\n<strong>            &lt;\/table&gt;<\/strong>\r\n\r\n<strong>            &lt;Pagination data={props.posts} \/&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>    );<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u30eb\u30fc\u30d7\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u306a\u3069<code>Vue<\/code>\u3068\u4f3c\u305f\u90e8\u5206\u3082\u3042\u308b\u306e\u3067\u3001<code>Vue<\/code>\u306b\u6163\u308c\u3066\u3044\u308b\u65b9\u306a\u3089\u6bd4\u8f03\u7684\u30b7\u30f3\u30d7\u30eb\u306b\u5b8c\u4e86\u3067\u304d\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002\uff08\u3061\u306a\u307f\u306b\u3001<code>route()<\/code>\u304c\u4f7f\u3048\u308b\u306e\u306f\u4fbf\u5229\u3067\u3059\u306d\ud83d\udc4d\uff09<\/p>\n<p>\u306a\u304a\u3001<code>&lt;Pagination \/&gt;<\/code>\u306e\u90e8\u5206\u306f\u72ec\u81ea\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u5f8c\u3067\u3064\u304f\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<h2>show<\/h2>\n<p><strong>resources\/js\/Pages\/Post\/Show.jsx<\/strong><\/p>\n<pre><strong>import React from \"react\";<\/strong>\r\n<strong>import { Link, Head } from '@inertiajs\/inertia-react';<\/strong>\r\n\r\n<strong>export default function Show(props) {<\/strong>\r\n\r\n<strong>    const { title, body } = props.post;<\/strong>\r\n\r\n<strong>    return (<\/strong>\r\n<strong>        &lt;div className=\"p-4\"&gt;<\/strong>\r\n<strong>            &lt;h1 className=\"font-bold mb-3\"&gt;{title}&lt;\/h1&gt;<\/strong>\r\n<strong>            &lt;div className=\"mb-3\"&gt;{body}&lt;\/div&gt;<\/strong>\r\n<strong>            &lt;Link className=\"text-white bg-blue-700 rounded-lg text-sm px-4 py-2\" href={route('post.index')}&gt;\u623b\u308b&lt;\/Link&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>    );<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p><code>post<\/code>\u30c7\u30fc\u30bf\u3092\u8868\u793a\u3057\u3066\u3044\u308b\u3060\u3051\u306e\u30b7\u30f3\u30d7\u30eb\u306a\u5185\u5bb9\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>create<\/h2>\n<p><strong>resources\/js\/Pages\/Post\/Create.jsx<\/strong><\/p>\n<pre><strong>import React from 'react';<\/strong>\r\n<strong>import PostForm from \"@\/Components\/Post\/Form\";<\/strong>\r\n\r\n<strong>export default function Create(props) {<\/strong>\r\n\r\n<strong>    const { post, errors } = props;<\/strong>\r\n\r\n<strong>    return (<\/strong>\r\n<strong>        &lt;PostForm type=\"create\" post={post} errors={errors}&gt;&lt;\/PostForm&gt;<\/strong>\r\n<strong>    );<\/strong>\r\n\r\n<strong>}<\/strong><\/pre>\n<p><code>edit<\/code>\u3068\u30d5\u30a9\u30fc\u30e0\u3092\u5171\u901a\u5316\u3057\u3066\u307e\u3059\u3002\uff08\u300c\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u308b\u300d\u3067\u7d39\u4ecb\u3057\u307e\u3059\uff09<\/p>\n<h2>edit<\/h2>\n<p><strong>resources\/js\/Pages\/Post\/Edit.jsx<\/strong><\/p>\n<pre><strong>import React from 'react';<\/strong>\r\n<strong>import PostForm from \"@\/Components\/Post\/Form\";<\/strong>\r\n\r\n<strong>export default function Edit(props) {<\/strong>\r\n\r\n<strong>    const { post, errors } = props;<\/strong>\r\n\r\n<strong>    return (<\/strong>\r\n<strong>        &lt;PostForm type=\"edit\" post={post} errors={errors}&gt;&lt;\/PostForm&gt;<\/strong>\r\n<strong>    );<\/strong>\r\n\r\n<strong>}<\/strong><\/pre>\n<p><code>create<\/code>\u3068\u30d5\u30a9\u30fc\u30e0\u3092\u5171\u901a\u5316\u3057\u3066\u307e\u3059\u3002\uff08\u300c\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u308b\u300d\u3067\u7d39\u4ecb\u3057\u307e\u3059\uff09<\/p>\n<h1>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u3001\u30d3\u30e5\u30fc\u306e\u4e2d\u3067\u30bb\u30c3\u30c8\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u5b58\u5728\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u305d\u308c\u305e\u308c\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30d5\u30a9\u30fc\u30e0<\/h2>\n<p><code>create<\/code>\u3068<code>edit<\/code>\u3067\u8868\u793a\u3059\u308b\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u306f\u307b\u3068\u3093\u3069\u540c\u3058\u306a\u306e\u3067\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u3057\u3066\u5171\u901a\u5316\u3057\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u306e\u3082\u3001\u5171\u901a\u5316\u3057\u3066\u304a\u304f\u3068\u3001\u3082\u3057\u5909\u66f4\u304c\u3042\u3063\u3066\u3082\uff11\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3060\u3051\u3092\u89e6\u308c\u3070OK\u306b\u306a\u308a\u3001\u5f8c\u3067\u30e9\u30af\u3067\u304d\u308b\u304b\u3089\u3067\u3059\uff08\u2190 \u30b3\u30ec\u5927\u4e8b \ud83d\ude0a\ud83d\udc4d\uff09<\/p>\n<p><strong>resources\/js\/Components\/Post\/Form.jsx<\/strong><\/p>\n<pre><strong>import React, { useState } from 'react';<\/strong>\r\n<strong>import Label from \"@\/Components\/Label\";<\/strong>\r\n<strong>import {Link, useForm} from \"@inertiajs\/inertia-react\";<\/strong>\r\n<strong>import {Inertia} from \"@inertiajs\/inertia\";<\/strong>\r\n<strong>import Loading from \"@\/Components\/Loading\";<\/strong>\r\n<strong>import _ from 'lodash';<\/strong>\r\n\r\n<strong>export default function Form(props) {<\/strong>\r\n\r\n<strong>    \/\/ Data<\/strong>\r\n<strong>    const type = props.type; \/\/ create or edit<\/strong>\r\n<strong>    const post = props.post;<\/strong>\r\n<strong>    const errors = props.errors;<\/strong>\r\n<strong>    const { data, setData } = useForm({<\/strong>\r\n<strong>        title: _.get(post, 'title', ''),<\/strong>\r\n<strong>        body: _.get(post, 'body', ''),<\/strong>\r\n<strong>    });<\/strong>\r\n<strong>    const [loading, setLoading] = useState(false);<\/strong>\r\n\r\n<strong>    \/\/ Methods<\/strong>\r\n<strong>    const onFinish = () =&gt; setLoading(false);<\/strong>\r\n<strong>    const onSubmit = () =&gt; {<\/strong>\r\n\r\n<strong>        setLoading(true);<\/strong>\r\n\r\n<strong>        if(type === 'create') { \/\/ \u767b\u9332 or \u5909\u66f4\u3067\u5207\u308a\u66ff\u3048\u308b<\/strong>\r\n\r\n<strong>            const url = route('post.store');<\/strong>\r\n<strong>            Inertia.post(url, data, { onFinish });<\/strong>\r\n\r\n<strong>        } else if(type === 'edit') {<\/strong>\r\n\r\n<strong>            const url = route('post.update', props.post.id);<\/strong>\r\n<strong>            Inertia.put(url, data, { onFinish });<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>    };<\/strong>\r\n\r\n<strong>    return (<\/strong>\r\n<strong>        &lt;div className=\"p-4\"&gt;<\/strong>\r\n<strong>            &lt;div className=\"mb-3\"&gt;<\/strong>\r\n<strong>                &lt;Label&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/Label&gt;<\/strong>\r\n<strong>                &lt;input className=\"w-80 border border-gray-500 p-2 rounded\" value={data.title} onChange={e =&gt; setData('title', e.target.value)} \/&gt;<\/strong>\r\n<strong>                {errors.title &amp;&amp; &lt;div className=\"mt-2 text-red-500 bg-red-100 p-2 rounded\"&gt;{errors.title}&lt;\/div&gt;}<\/strong>\r\n<strong>            &lt;\/div&gt;<\/strong>\r\n<strong>            &lt;div className=\"mb-3\"&gt;<\/strong>\r\n<strong>                &lt;Label&gt;\u672c\u6587&lt;\/Label&gt;<\/strong>\r\n<strong>                &lt;textarea className=\"w-80 border border-gray-500 p-2 rounded\" value={data.body} onChange={e =&gt; setData('body', e.target.value)} \/&gt;<\/strong>\r\n<strong>                {errors.body &amp;&amp; &lt;div className=\"mt-2 text-red-500 bg-red-100 p-2 rounded\"&gt;{errors.body}&lt;\/div&gt;}<\/strong>\r\n<strong>            &lt;\/div&gt;<\/strong>\r\n<strong>            &lt;button type=\"button\" className=\"text-white bg-blue-700 rounded-lg text-sm px-4 py-2 mr-5\" onClick={onSubmit}&gt;\u9001\u4fe1\u3059\u308b&lt;\/button&gt;<\/strong>\r\n<strong>            &lt;Link href={route('post.index')}&gt;\u623b\u308b&lt;\/Link&gt;<\/strong>\r\n<strong>            &lt;br \/&gt;<\/strong>\r\n<strong>            &lt;Loading show={loading}&gt;&lt;\/Loading&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>    );<\/strong>\r\n\r\n<strong>}<\/strong><\/pre>\n<p>\u5185\u5bb9\u3068\u3057\u3066\u306f\u3001\u30d5\u30a9\u30fc\u30e0\u3067\u30c7\u30fc\u30bf\u3092\u7ba1\u7406\u3057\u3001\u9001\u4fe1\u3059\u308b\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001<code>Lodash<\/code>\u306f\u3053\u3046\u3044\u3046\u3068\u304d\u4fbf\u5229\u3067\u3059\u306d\ud83d\udc4d<\/p>\n<h2>\u30da\u30fc\u30b8\u30ea\u30f3\u30af<\/h2>\n<p>\u3067\u306f\u3001\u6b21\u306b\u30da\u30fc\u30b8\u30ea\u30f3\u30af\uff08<code>pagination<\/code>\uff09\u3067\u3059\u3002<\/p>\n<p><strong>resources\/js\/Components\/Pagination.jsx<\/strong><\/p>\n<pre><strong>import React from 'react';<\/strong>\r\n<strong>import NavLink from \"@\/Components\/NavLink\";<\/strong>\r\n\r\n<strong>export default function Pagination({ data }) {<\/strong>\r\n\r\n<strong>    return (<\/strong>\r\n<strong>        &lt;div className=\"bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6\"&gt;<\/strong>\r\n<strong>            &lt;div className=\"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between\"&gt;<\/strong>\r\n<strong>                &lt;div&gt;<\/strong>\r\n<strong>                    &lt;nav className=\"relative z-0 inline-flex rounded-md shadow-sm -space-x-px\"&gt;<\/strong>\r\n<strong>                        {data.total &gt; 0 &amp;&amp; data.links.map(link =&gt; (<\/strong>\r\n<strong>                            &lt;NavLink<\/strong>\r\n<strong>                                key={link.label}<\/strong>\r\n<strong>                                href={link.url}<\/strong>\r\n<strong>                                active={link.active}&gt;<\/strong>\r\n<strong>                                &lt;span dangerouslySetInnerHTML={{ __html: link.label }} \/&gt;<\/strong>\r\n<strong>                            &lt;\/NavLink&gt;<\/strong>\r\n<strong>                        ))}<\/strong>\r\n<strong>                    &lt;\/nav&gt;<\/strong>\r\n<strong>                &lt;\/div&gt;<\/strong>\r\n<strong>            &lt;\/div&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>    );<\/strong>\r\n\r\n<strong>}<\/strong><\/pre>\n<p>\u3053\u3053\u3067\u306f\u3001<code>Laravel<\/code>\u306e<code>paginate()<\/code>\u304b\u3089\u53d6\u5f97\u3067\u304d\u308b\u30c7\u30fc\u30bf\u69cb\u9020\u306b\u5408\u308f\u305b\u3066\u30da\u30fc\u30b8\u30ea\u30f3\u30af\u3092\u3064\u304f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30ed\u30fc\u30c7\u30a3\u30f3\u30b0\uff08\u9001\u4fe1\u4e2d\u304b\u3069\u3046\u304b\u304c\u5206\u304b\u308b\u8868\u793a\uff09<\/h2>\n<p>\u9001\u4fe1\u6642\u306b\u4f55\u3082\u30ea\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u306a\u3044\u3068\u3001\u300c<strong>\u3093\u2026\u9001\u4fe1\u3055\u308c\u3066\u308b\uff1f\uff1f<\/strong>\u300d\u3068\u4e0d\u5b89\u306b\u306a\u308b\u306e\u3067\u3001\u5b8c\u4e86\u3059\u308b\u307e\u3067\u306e\u9593\u300c<strong>\u8aad\u307f\u8fbc\u307f\u4e2d&#8230;<\/strong>\u300d\u3068\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u30af\u30eb\u30af\u30eb\u56de\u308b\u30a2\u30a4\u30b3\u30f3\u3092\u4f7f\u3046\u3068\u3001\u3088\u308a\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u611f\u304c\u3042\u3063\u3066\u3044\u3044\u3067\u3059\u306d\ud83d\udc4d<\/p>\n<p><strong>resources\/js\/Components\/Loading.jsx<\/strong><\/p>\n<pre>import React from 'react';\r\n\r\nexport default function Loading({ show = false }) {\r\n\r\n    return (\r\n        &lt;&gt;\r\n            {show &amp;&amp; &lt;span&gt;\u8aad\u307f\u8fbc\u307f\u4e2d...&lt;\/span&gt;}\r\n        &lt;\/&gt;\r\n    );\r\n\r\n}<\/pre>\n<p>\u3053\u3053\u3067\u306f\u3001<code>show<\/code>\u304c<code>true<\/code>\u304b<code>false<\/code>\u304b\u3067\u8868\u793a\uff0f\u975e\u8868\u793a\u3092\u5207\u308a\u66ff\u3048\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u30eb\u30fc\u30c8\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u3092\u8ffd\u52a0\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>Route::prefix('post')-&gt;controller(PostController::class)-&gt;group(function(){<\/strong>\r\n\r\n<strong>    Route::get('\/', 'index')-&gt;name('post.index');<\/strong>\r\n<strong>    Route::get('\/create', 'create')-&gt;name('post.create');<\/strong>\r\n<strong>    Route::post('\/', 'store')-&gt;name('post.store');<\/strong>\r\n<strong>    Route::get('\/{post}', 'show')-&gt;name('post.show');<\/strong>\r\n<strong>    Route::get('\/{post}\/edit', 'edit')-&gt;name('post.edit');<\/strong>\r\n<strong>    Route::put('\/{post}', 'update')-&gt;name('post.update');<\/strong>\r\n<strong>    Route::delete('\/{post}', 'destroy')-&gt;name('post.destroy');<\/strong>\r\n\r\n<strong>});<\/strong>\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<p>\u4f5c\u696d\u306f\u3053\u3053\u3067\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude0a\u2728<\/p>\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<br \/>\n\u307e\u305a\u306f\u30d6\u30e9\u30a6\u30b6\u3067\u300c<strong>http:\/\/******\/post<\/strong>\u300d\u3078\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10868\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_2.png\" alt=\"\" width=\"640\" height=\"226\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_2.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_2-300x106.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u306f\u3044\u2757\u30da\u30fc\u30b8\u4e00\u89a7\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u30c7\u30fc\u30bf\u3092\u767b\u9332\u3059\u308b\u305f\u3081\u306b\u300c<strong>+ \u8ffd\u52a0\u3059\u308b<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10869\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_3.png\" alt=\"\" width=\"131\" height=\"63\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u9001\u4fe1\u30dc\u30bf\u30f3\u3092\u62bc\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10870\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_4.png\" alt=\"\" width=\"362\" height=\"248\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_4.png 362w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_4-300x206.png 300w\" sizes=\"auto, (max-width: 362px) 100vw, 362px\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10871\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_5.png\" alt=\"\" width=\"461\" height=\"224\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_5.png 461w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_5-300x146.png 300w\" sizes=\"auto, (max-width: 461px) 100vw, 461px\" \/><\/p>\n<p>\u30da\u30fc\u30b8\u304c\u79fb\u52d5\u3057\u3066\u5b8c\u4e86\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u3067\u306f\u3001\u30da\u30fc\u30b8\u30ea\u30f3\u30af\u306e\u6700\u5f8c\u307e\u3067\u79fb\u52d5\u3057\u3066\u30c7\u30fc\u30bf\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10872\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_6.png\" alt=\"\" width=\"582\" height=\"233\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_6.png 582w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_6-300x120.png 300w\" sizes=\"auto, (max-width: 582px) 100vw, 582px\" \/><\/p>\n<p>\u306f\u3044\u2757\u5148\u307b\u3069\u767b\u9332\u3057\u305f\u30c7\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u6b21\u306b\u3053\u306e\u30c7\u30fc\u30bf\u3067\u5909\u66f4\u6a5f\u80fd\u306e\u30c1\u30a7\u30c3\u30af\u3092\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\n\u3059\u3050\u53f3\u5074\u306b\u3042\u308b\u300c<strong>\u5909\u66f4<\/strong>\u300d\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-10873\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_7.png\" alt=\"\" width=\"320\" height=\"121\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_7.png 320w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_7-300x113.png 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u5148\u307b\u3069\u3068\u540c\u3058\u30d5\u30a9\u30fc\u30e0\uff08\u5171\u901a\u5316\u3057\u3066\u3044\u308b\u90e8\u5206\uff09\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u5909\u66f4\u3057\u3066\u9001\u4fe1\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10874\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_8.png\" alt=\"\" width=\"358\" height=\"248\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_8.png 358w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_8-300x208.png 300w\" sizes=\"auto, (max-width: 358px) 100vw, 358px\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10875\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_9.png\" alt=\"\" width=\"444\" height=\"116\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_9.png 444w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_9-300x78.png 300w\" sizes=\"auto, (max-width: 444px) 100vw, 444px\" \/><\/p>\n<p>\u5909\u66f4\u5b8c\u4e86\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u4eca\u56de\u3082\u30da\u30fc\u30b8\u79fb\u52d5\u3057\u3066\u304d\u3061\u3093\u3068\u30c7\u30fc\u30bf\u5909\u66f4\u3067\u304d\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10876\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_10.png\" alt=\"\" width=\"731\" height=\"197\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_10.png 731w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_10-300x81.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u5148\u307b\u3069\u306e\u5909\u66f4\u304c\u53cd\u6620\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u7d9a\u3044\u3066\u78ba\u8a8d\u30da\u30fc\u30b8\u3067\u3059\u3002<br \/>\n\u3059\u3050\u53f3\u5074\u306b\u3042\u308b\u300c<strong>\u78ba\u8a8d<\/strong>\u300d\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-10877\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_11.png\" alt=\"\" width=\"320\" height=\"121\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_11.png 320w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_11-300x113.png 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10878\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_12.png\" alt=\"\" width=\"305\" height=\"133\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_12.png 305w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_12-300x131.png 300w\" sizes=\"auto, (max-width: 305px) 100vw, 305px\" \/><\/p>\n<p>\u306f\u3044\u2757\u5148\u307b\u3069\u5909\u66f4\u3057\u305f\u5185\u5bb9\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u524a\u9664\u3067\u3059\u3002<br \/>\n\u5148\u307b\u3069\u306b\u4e00\u89a7\u30da\u30fc\u30b8\u306b\u623b\u3063\u3066\u300c<strong>\u524a\u9664<\/strong>\u300d\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-10879\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_13.png\" alt=\"\" width=\"320\" height=\"121\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_13.png 320w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_13-300x113.png 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/p>\n<p>\u30a2\u30e9\u30fc\u30c8\u78ba\u8a8d\u304c\u3067\u308b\u306e\u3067\u300c<strong>OK<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10880\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_14.png\" alt=\"\" width=\"449\" height=\"238\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_14.png 449w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/08\/laravel_vite_inertia_react_crud_14-300x159.png 300w\" sizes=\"auto, (max-width: 449px) 100vw, 449px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p>\u524a\u9664\u5b8c\u4e86\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u3001\u5148\u307b\u3069\u307e\u3067\u8868\u793a\u3055\u308c\u3066\u3044\u305f\u30c7\u30fc\u30bf\u304c\u6d88\u3048\u307e\u3057\u305f\u3002<\/p>\n<p>\u3059\u3079\u3066\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u3053\u308c\u306f<code>React<\/code>\u306b\u9650\u3089\u305a\u3067\u3059\u304c\u3001\u4eca\u56de\u306e\u3088\u3046\u306b\u5171\u901a\u90e8\u5206\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u3064\u304f\u308a\u3001\u5225\u306e\u5834\u6240\u3067\u3082\u5229\u7528\u3057\u3084\u3059\u304f\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001\u958b\u767a\u306e\u30b9\u30d4\u30fc\u30c9\u3092\u3042\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001CSS\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3082\u540c\u3058\u3082\u306e\u3092\u3064\u304b\u3063\u3066\u3044\u308b\u5834\u5408\u3067\u3057\u305f\u3089\u3001\u8907\u6570\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u9593\u3067\u3082\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u518d\u5229\u7528\u3057\u3084\u3059\u3044\u305f\u3081\u3001\u3055\u3089\u306b\u958b\u767a\u52b9\u7387\u3092\u4e0a\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u305c\u3072\u305d\u3046\u3044\u3063\u305f\u958b\u767a\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u3001\u3044\u3064\u3067\u3082\u304a\u6c17\u8efd\u306b\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude0a\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u300c<strong>Laravel + Vite + Inertia + React<\/strong>\u300d\u3067<code>CRUD<\/code>\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001\u79c1\u306f\u9577\u5e74\u300c<strong>Vue\u6d3e<\/strong>\u300d\u3060\u3063\u305f\u306e\u3067<code>React<\/code>\u306f\u3042\u307e\u308a\u4f7f\u3063\u3066\u6765\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u6614\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u305f\u3068\u304d\u3088\u308a\u306f\u30bc\u30f3\u30bc\u30f3\u597d\u5370\u8c61\u3067\u3057\u305f\u3002<\/p>\n<p>\u300c\u30d0\u30fc\u30c1\u30e3\u30ebDOM\u300d\u306e<code>className<\/code>\u306f\u3061\u3087\u3063\u3068\u5acc\u304b\u306a\u3068\u306f\u601d\u3046\u306e\u3067\u3059\u304c\u3001\u5168\u4f53\u7684\u306b\u6574\u7406\u6574\u9813\u3055\u308c\u305f\u30b3\u30fc\u30c9\u304c\u66f8\u3051\u307e\u3059\u3057\u3001\u306a\u306b\u3088\u308a<code>Vite<\/code>\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067<code>npm<\/code>\u306e\u3068\u304d\u306e\u3088\u3046\u306a\u30d3\u30eb\u30c9\u6642\u9593\u304c\u4e0d\u8981\u3068\u3044\u3046\u306e\u3082\u5927\u304d\u306a\u7406\u7531\u306e\uff11\u3064\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u5c11\u3057\u524d\u306b<code>livewire<\/code>\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u500b\u4eba\u7684\u306a\u5370\u8c61\u3068\u3057\u3066\u306f\u305d\u3063\u3061\u306b\u8fd1\u3044\u306e\u304b\u306a\u3001\u3068\u3044\u3046\u5370\u8c61\u3092\u53d7\u3051\u307e\u3057\u305f\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082<code>Vue<\/code>\u3068\u306e\u9055\u3044\u3092\u697d\u3057\u3093\u3067\u307f\u3066\u304f\u3060\u3055\u3044\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-9238 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4.png\" alt=\"\" width=\"318\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4.png 318w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4-298x300.png 298w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4-150x150.png 150w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4-100x100.png 100w\" sizes=\"auto, (max-width: 318px) 100vw, 318px\" \/>\u300c\u30ef\u30fc\u30b1\u30fc\u30b7\u30e7\u30f3\u3057\u305f\u3089\u3001<br \/>\n\u751f\u6d3b\u30ea\u30ba\u30e0\u304c<br \/>\n\u30d0\u30e9\u30d0\u30e9\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u2026\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u300cVite + Inertia + React\u300d\u3067\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u3082\u305d\u306e\u6d41\u308c\u3067\u57fa\u672c\u7684\u306a\u300c\u8ffd\u52a0\u30fb\u5909\u66f4\u30fb\u524a\u9664\u30fb\u95b2\u89a7\u300d\u90e8\u5206\uff08\u3044\u308f\u3086 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=10860\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010Laravel\u3011Vite + Inertia + React \u3067\u300c\u8ffd\u52a0\u30fb\u5909\u66f4\u30fb\u524a\u9664\u30fb\u95b2\u89a7\u300d\u6a5f\u80fd\u3092\u3064\u304f\u308b\uff08CRUD\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":10883,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[247,3,118,248],"tags":[],"class_list":["post-10860","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-inertia-js","category-laravel","category-react-js","category-vite"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10860","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=10860"}],"version-history":[{"count":11,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10860\/revisions"}],"predecessor-version":[{"id":11502,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/10860\/revisions\/11502"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/10883"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}