{"id":11359,"date":"2022-01-07T10:00:00","date_gmt":"2022-01-07T01:00:00","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=11359"},"modified":"2022-01-06T18:57:49","modified_gmt":"2022-01-06T09:57:49","slug":"jetstream%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6laravel-8-livewire-crud%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%ae%e4%bd%9c%e6%88%90","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/11359","title":{"rendered":"JetStream\u3092\u4f7f\u7528\u3057\u3066Laravel 8 Livewire CRUD\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u6210"},"content":{"rendered":"\n<p>\u4eca\u56de\u306f\u3001Laravel\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u5fc5\u8981\u4e0d\u53ef\u6b20\u306aCRUD\u64cd\u4f5c\u3092\u3001Livewire\u3068Jetstream\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u7c21\u5358\u306b\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u8a2d\u5b9a<\/p>\n\n\n\n<p>\u65b0\u3057\u3044laravel\u30a2\u30d7\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306e\u3067\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u5411\u304b\u3044\u3001\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3001\u65b0\u3057\u3044laravel\u30a2\u30d7\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>composer create-project --prefer-dist laravel\/laravel laravel_livewire_crud<\/code><\/pre>\n\n\n\n<p>.env\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a73\u7d30\u3092\u8ffd\u52a0\u3059\u308b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"451\" height=\"133\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-12.03.08.png\" alt=\"\" class=\"wp-image-11360\" \/><\/figure>\n\n\n\n<p>Model\u30d5\u30a1\u30a4\u30eb\u3001Migration\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan make:model Student -m<\/code><\/pre>\n\n\n\n<p>\u4f8b\u3048\uff1a<br>app\/Models\/Student.php\u30d5\u30a1\u30a4\u30eb\u306b$fillable\u914d\u5217\u3092\u8ffd\u52a0\u3057\u3001\u540d\u524d\u3001\u30e1\u30fc\u30eb\u3001\u643a\u5e2f\u96fb\u8a71\u306a\u3069\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u5024\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"439\" height=\"131\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-12.09.34.png\" alt=\"\" class=\"wp-image-11361\" \/><\/figure>\n\n\n\n<p>\u307e\u305f\u3001\u5b66\u751f\u7528\u306emigration\u30c6\u30fc\u30d6\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"538\" height=\"147\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-12.12.34.png\" alt=\"\" class=\"wp-image-11362\" \/><\/figure>\n\n\n\n<p>Livewire\u3068Jetstream\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>composer require laravel\/jetstream<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan jetstream:install livewire<\/code><\/pre>\n\n\n\n<p>\u3055\u3089\u306b\u3001\u30a2\u30bb\u30c3\u30c8\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3001\u4e21\u65b9\u306enpm\u30b3\u30de\u30f3\u30c9\u3092\u540c\u6642\u306b\u4f7f\u7528\u3057\u3066\u3001\u30d3\u30eb\u30c9\u30b3\u30f3\u30d1\u30a4\u30eb\u30bf\u30b9\u30af\u3092\u5b8c\u4e86\u3055\u305b\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install &amp;&amp; npm run dev<\/code><\/pre>\n\n\n\n<p>\u6700\u5f8c\u306b\u3001php artisan\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u79fb\u884c\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan migrate<\/code><\/pre>\n\n\n\n<p>Livewire\u306ecrud\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u751f\u6210\u3059\u308b\u305f\u3081<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan make:livewire crud<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"561\" height=\"156\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-12.20.39.png\" alt=\"\" class=\"wp-image-11363\" \/><\/figure>\n\n\n\n<p>\u4e0a\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u30012\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u30eb\u30fc\u30c8\u306e\u4f5c\u6210<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Route::get('students', Crud::class);<\/code><\/pre>\n\n\n\n<p>\u6700\u521d\u306e\u30da\u30fc\u30b8\u306b\u751f\u5f92\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3057\u305f\u3044\u306e\u3067\u3001render\u95a2\u6570\u3067\u5168\u751f\u5f92\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"431\" height=\"100\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-12.29.34-1.png\" alt=\"\" class=\"wp-image-11365\" \/><\/figure>\n\n\n\n<p>\u751f\u5f92\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u3001<br>\u30dc\u30bf\u30f3\u306b wire:click=&#8221;create()&#8221; \u3068\u3044\u3046\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;button<span class=\"has-inline-color has-vivid-cyan-blue-color\"> wire:click=\"create()\"<\/span>\n                class=\"my-4 inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 bg-red-600 text-base font-bold text-white shadow-sm hover:bg-red-700\"&gt;\n                Create Student\n &lt;\/button&gt;<\/code><\/pre>\n\n\n\n<p>\u5b66\u751f\u306e\u4f5c\u6210\u3092\u30e2\u30c7\u30eb\u30d5\u30a9\u30fc\u30e0\u3068\u3057\u3066\u30c7\u30b6\u30a4\u30f3\u3057\u305f\u3044\u306e\u3067\u3001\u3044\u304f\u3064\u304b\u6761\u4ef6\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002True \u3092\u6307\u5b9a\u3059\u308b\u3068\u30e2\u30c7\u30eb\u30dc\u30c3\u30af\u30b9\u304c\u958b\u304d\u3001False \u3092\u6307\u5b9a\u3059\u308b\u3068\u30e2\u30c7\u30eb\u30dc\u30c3\u30af\u30b9\u304c\u9589\u3058\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"499\" height=\"390\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-12.49.11.png\" alt=\"\" class=\"wp-image-11368\" \/><\/figure>\n\n\n\n<p>\u751f\u5f92\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u3001<br>\u30dc\u30bf\u30f3\u306b wire:click.prevent=&#8221;store()&#8221; \u3068\u3044\u3046\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;button<span class=\"has-inline-color has-black-color\"> <\/span><span class=\"has-inline-color has-vivid-cyan-blue-color\">wire:click.prevent=\"store()\" <\/span> type=\"button\"\n                            class=\"inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 bg-red-600 text-base \n                            leading-6 font-bold text-white shadow-sm hover:bg-red-700 focus:outline-none \n                            focus:border-green-700 focus:shadow-outline-green transition ease-in-out duration-150 sm:text-sm sm:leading-5\"&gt;\n                            Store\n&lt;\/button&gt;<\/code><\/pre>\n\n\n\n<p>updateOrCreate\u3092\u4f7f\u7528\u3057\u3066\u3001\u4fdd\u5b58\u3068\u66f4\u65b0\u306e\u4e21\u65b9\u306e\u95a2\u6570\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"721\" height=\"351\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-12.53.05.png\" alt=\"\" class=\"wp-image-11370\" \/><\/figure>\n\n\n\n<p>\u5b66\u751f\u306e\u7de8\u96c6\u3092\u884c\u3046\u306b\u306f<br>\u30dc\u30bf\u30f3\u306b wire:click=&#8221;edit({{ $student-&gt;id }})&#8221; \u3068\u3044\u3046\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5f8c\u5b66\u751f\u306e\u524a\u9664\u3092\u884c\u3046\u306b\u306f<br>\u30dc\u30bf\u30f3\u306b wire:click=&#8221;delete({{ $student-&gt;id }})&#8221; \u3068\u3044\u3046\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;button <span class=\"has-inline-color has-vivid-cyan-blue-color\">wire:click=\"edit({{ $student-&gt;id }})\"<\/span>\n                                class=\"flex px-4 py-2 bg-gray-500 text-gray-900 cursor-pointer\"&gt;Edit&lt;\/button&gt;\n&lt;button <span class=\"has-inline-color has-vivid-cyan-blue-color\">wire:click=\"delete({{ $student-&gt;id }})\"<\/span>\n                                class=\"flex px-4 py-2 bg-red-100 text-gray-900 cursor-pointer\"&gt;Delete&lt;\/button&gt;<\/code><\/pre>\n\n\n\n<p>\u7de8\u96c6\u3068\u524a\u9664\u3092\u884c\u3046\u305f\u3081\u306b\u3001\u751f\u5f92\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3066\u3001\u524a\u9664\u6a5f\u80fd\u306f\u751f\u5f92\u306e\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"838\" height=\"304\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-13.00.36.png\" alt=\"\" class=\"wp-image-11372\" \/><\/figure>\n\n\n\n<p>\u305d\u306e\u7d50\u679c\u306f<\/p>\n\n\n\n<p>\u5b66\u751f\u4e00\u89a7<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"1217\" height=\"432\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-13.08.27.png\" alt=\"\" class=\"wp-image-11373\" \/><\/figure>\n\n\n\n<p>\u5b66\u751f\u3092\u4f5c\u308b\u305f\u3081\u306b<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"1224\" height=\"516\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-13.10.22.png\" alt=\"\" class=\"wp-image-11374\" \/><\/figure>\n\n\n\n<p>\u5b66\u751f\u3092\u7de8\u96c6\u3059\u308b\u306b\u306f<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"1217\" height=\"518\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2022\/01\/Screen-Shot-2022-01-06-at-13.14.14.png\" alt=\"\" class=\"wp-image-11375\" \/><\/figure>\n\n\n\n<p>\u6700\u5f8c\u307e\u3067\u304a\u8aad\u307f\u3044\u305f\u3060\u304d\u3001\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>By Ami<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11359\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/11359\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"JetStream\u3092\u4f7f\u7528\u3057\u3066Laravel 8 Livewire CRUD\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u6210\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11359\" data-text=\"JetStream\u3092\u4f7f\u7528\u3057\u3066Laravel 8 Livewire CRUD\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u6210\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11359\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/11359\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306f\u3001Laravel\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u5fc5\u8981\u4e0d\u53ef\u6b20\u306aCRUD\u64cd\u4f5c\u3092\u3001Livewire\u3068Jetstream\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3063\u3066\u7c21\u5358\u306b\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u8a2d\u5b9a \u65b0\u3057\u3044laravel\u30a2\u30d7\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059 [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11359"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=11359"}],"version-history":[{"count":5,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11359\/revisions"}],"predecessor-version":[{"id":11383,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/11359\/revisions\/11383"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=11359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=11359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=11359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}