{"id":1418,"date":"2018-10-11T03:17:32","date_gmt":"2018-10-10T18:17:32","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=1418"},"modified":"2019-06-03T16:14:49","modified_gmt":"2019-06-03T07:14:49","slug":"laravelvue%e3%81%a7%e3%83%aa%e3%82%a2%e3%83%ab%e3%82%bf%e3%82%a4%e3%83%a0%e3%83%bb%e3%83%81%e3%83%a3%e3%83%83%e3%83%88%e3%82%92%e3%81%a4%e3%81%8f%e3%82%8b%ef%bc%88%e3%83%80%e3%82%a6%e3%83%b3%e3%83%ad","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=1418","title":{"rendered":"Laravel+Vue\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30fb\u30c1\u30e3\u30c3\u30c8\u3092\u3064\u304f\u308b\uff08\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u53ef\uff09"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001Laravel\u306e\u6a5f\u80fd\u306f\u6642\u9593\u3092\u8ffd\u3046\u3054\u3068\u306b\u3069\u3093\u3069\u3093\u5897\u3048\u3066\u3044\u3063\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u3055\u3059\u304c\u4e16\u754c\u4e2d\u306e\u512a\u79c0\u306a\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u305f\u3061\u304c\u65b0\u3057\u3044\u4fbf\u5229\u306a\u6a5f\u80fd\u3092\u30d7\u30eb\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u3066\u3044\u308b\u3060\u3051\u3042\u3063\u3066\u305d\u306e\u30b9\u30d4\u30fc\u30c9\u306f\u76ee\u3092\u898b\u5f35\u308b\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u305d\u3046\u306a\u3063\u3066\u304f\u308b\u3068\u3001\u300c\u4eca\u306f\u5fc5\u8981\u306a\u3044\u3051\u3069\u3044\u3064\u304b\u306f\u8a66\u3057\u3066\u307f\u305f\u3044\u6a5f\u80fd\u300d\u304c\u5897\u3048\u3066\u3057\u307e\u3063\u3066\u3001\u307e\u3055\u306b\u300c\u7a4d\u3093\u8aad\uff08\u3064\u3093\u3069\u304f\uff09\u300d\u72b6\u614b\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u306f\u79c1\u81ea\u8eab\u3082\u3044\u304f\u3064\u304b\u8a66\u3057\u3066\u307f\u305f\u3044\u6a5f\u80fd\u304c\u3042\u308b\u3093\u3067\u3059\u304c\u3001\u4eca\u65e5\u306f\u305d\u3093\u306a\u4e2d\u304b\u3089\u300cLaravel Echo\u300d\u3092\u53d6\u308a\u4e0a\u3052\u3066\u8a18\u4e8b\u3092\u66f8\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Larael Echo\u306f\u300c\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c6\u30a3\u30f3\u30b0\u300d\u3068\u547c\u3070\u308c\u308b<strong>\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u30d6\u30e9\u30a6\u30b6\u306b\u30a4\u30d9\u30f3\u30c8\u901a\u77e5\uff08\u53d7\u4fe1\uff09\u304c\u3067\u304d\u308b\u6a5f\u80fd<\/strong>\u3067\u3001\u4eca\u56de\u306f\u3053\u308c\u3092\u5229\u7528\u3057\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30c1\u30e3\u30c3\u30c8\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u3001\u307f\u306a\u3055\u3093\u3082\u3084\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1419 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/10.png\" alt=\"\" width=\"306\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/10.png 306w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/10-287x300.png 287w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/><\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068\uff08\u30b4\u30fc\u30eb\uff09<\/h1>\n<p>\u4f8b\u3048\u3070\u30d6\u30e9\u30a6\u30b6\u3067\u30bf\u30d6\u3092\uff12\u3064\u958b\u3044\u3066\u3001\u7247\u65b9\u306e\u30da\u30fc\u30b8\u304b\u3089\u300c\u30cf\u30ed\u30fc\uff01\u300d\u3068\u9001\u4fe1\u3059\u308b\u3068\u3001\u3082\u3046\u7247\u65b9\u306e\u30da\u30fc\u30b8\u304c\u81ea\u52d5\u7684\u306b\u66f4\u65b0\u3055\u308c\u308b\u7c21\u6613\u7684\u306a\u30c1\u30e3\u30c3\u30c8\u30b7\u30b9\u30c6\u30e0\u3002<\/p>\n<p>\u8907\u96d1\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3068\u826f\u304f\u306a\u3044\u306e\u3067\u3001\u4eca\u56de\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u306f\u4f7f\u308f\u305a\u8ab0\u3067\u3082\u30c1\u30e3\u30c3\u30c8\u306b\u53c2\u52a0\u3067\u304d\u308b\u3088\u3046\u306a\u3082\u306e\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u958b\u767a\u74b0\u5883\u306fLaravel 5.7\u3067\u3059\uff01<\/p>\n<h1>\u30e1\u30c3\u30bb\u30fc\u30b8\u30fb\u30c6\u30fc\u30d6\u30eb\u3092\u3064\u304f\u308b<\/h1>\n<p>\u307e\u305a\u9001\u4fe1\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304f\u30c6\u30fc\u30d6\u30eb\u3092\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\u4f5c\u308a\u307e\u3059\u3002\uff08\u3069\u3046\u305b\u30e2\u30c7\u30eb\u3082\u5fc5\u8981\u306b\u306a\u308b\u306e\u3067\u30e2\u30c7\u30eb + \u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u4e00\u6c17\u306b\u3064\u304f\u308a\u307e\u3059\uff09<\/p>\n<pre><strong>php artisan make:model Message -m<\/strong><\/pre>\n<p>\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u305f\u3089\u3001\u4f5c\u6210\u3055\u308c\u305f<code>****_**_**_******_create_messages_table.php<\/code>\u3092\u958b\u3044\u3066<code>up()<\/code>\u306e\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>public function up()\r\n{\r\n<strong>    Schema::create('messages', function (Blueprint $table) {<\/strong>\r\n<strong>        $table-&gt;increments('id');<\/strong>\r\n<strong>        $table-&gt;text('body'); \/\/ \u30e1\u30c3\u30bb\u30fc\u30b8\u672c\u6587<\/strong>\r\n<strong>        $table-&gt;timestamps();<\/strong>\r\n<strong>    });<\/strong>\r\n}<\/pre>\n<p>\u305d\u3057\u3066\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<p>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u305f\u3089\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1420\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table.png\" alt=\"\" width=\"340\" height=\"474\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table.png 340w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table-215x300.png 215w\" sizes=\"auto, (max-width: 340px) 100vw, 340px\" \/><\/p>\n<p>\u307e\u305f\u3001\u30c7\u30fc\u30bf\u8ffd\u52a0\u306e\u969b\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u306e\u3067\u3001<code>Message<\/code>\u30e2\u30c7\u30eb\u306b<code>$guarded<\/code>\u3092\u8ffd\u52a0\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>class Message extends Model\r\n{\r\n    <strong>protected $guarded = ['id'];<\/strong>\r\n}<\/pre>\n<p>\u305d\u3057\u3066\u3001\u30c1\u30e3\u30c3\u30c8\u6587\u304c\u3044\u304f\u3064\u304b\u3042\u308b\u3068\u5f8c\u3067\u958b\u767a\u304c\u3057\u3084\u3059\u3044\u306e\u3067\u3001Seeder\u3092\u4f7f\u3063\u3066<code>messages<\/code>\u30c6\u30fc\u30d6\u30eb\u306b\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>php artisan make:seed MessagesTableSeeder<\/strong><\/pre>\n<p><code>database\/seeds\/MessagesTableSeeder.php<\/code>\u3092\u958b\u3044\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30c6\u30b9\u30c8\u7528\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u3044\u304f\u3064\u304b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre>public function run()\r\n{\r\n<strong>    for($i = 1 ; $i &lt;= 10 ; $i++) {<\/strong>\r\n\r\n<strong>        \\App\\Message::create([<\/strong>\r\n<strong>            'body' =&gt; $i .'\u756a\u76ee\u306e\u30c6\u30ad\u30b9\u30c8'<\/strong>\r\n<strong>        ]);<\/strong>\r\n\r\n<strong>    }<\/strong>\r\n}<\/pre>\n<p>\u3067\u306f\u3001<code>database\/seeds\/DatabaseSeeder.php<\/code>\u306b\u767b\u9332\u3057\u3066Seeder\u3092\u5b9f\u884c\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>public function run()\r\n{\r\n     $this-&gt;call(UsersTableSeeder::class);\r\n     <strong>$this-&gt;call(MessagesTableSeeder::class);<\/strong>\r\n}<\/pre>\n<pre>php artisan migrate:fresh --seed<\/pre>\n<p>Seeder\u306e\u5b9f\u884c\u304c\u5b8c\u4e86\u3059\u308b\u3068\u3001\u30c6\u30fc\u30d6\u30eb\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1422\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table_2.png\" alt=\"\" width=\"517\" height=\"484\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table_2.png 517w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table_2-300x281.png 300w\" sizes=\"auto, (max-width: 517px) 100vw, 517px\" \/><\/p>\n<h1>\u30c1\u30e3\u30c3\u30c8\u30da\u30fc\u30b8\u3092\u4f5c\u308b<\/h1>\n<p>\u3067\u306f\u6b21\u306b\u3001\u30e6\u30fc\u30b6\u30fc\u304c\u5b9f\u969b\u306b\u76ee\u306b\u3059\u308b\u30c1\u30e3\u30c3\u30c8\u30da\u30fc\u30b8\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>Route\u3092\u8ffd\u52a0\u3059\u308b<\/h2>\n<p>\u4ee5\u4e0b\u306eRoute\u3092<code>web.php<\/code>\u306b\u8ffd\u52a0\u3057\u3066<code>\/chat<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>Route::get('chat', 'ChatController@index');<\/strong><\/pre>\n<h2>Controller\u3092\u8ffd\u52a0\u3059\u308b<\/h2>\n<p>\u307e\u3060<code>ChatController<\/code>\u306f\u3064\u304f\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u4f5c\u6210\u3002<\/p>\n<pre><strong>php artisan make:controller ChatController<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001\u4f5c\u6210\u3055\u308c\u305f<code>app\/Http\/Controllers\/ChatController.php<\/code>\u3092\u958b\u3044\u3066<code>index()<\/code>\u306e\u4e2d\u3067<code>chat<\/code>\u3068\u3044\u3046\u540d\u524d\u306e\u30d3\u30e5\u30fc\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>public function index() {<\/strong>\r\n\r\n<strong>    return view('chat'); \/\/ \u30d5\u30a9\u30fc\u30e0\u30da\u30fc\u30b8\u306e\u30d3\u30e5\u30fc<\/strong>\r\n\r\n<strong>}<\/strong><\/pre>\n<h2>\u30d3\u30e5\u30fc\u3092\u8ffd\u52a0\u3059\u308b<\/h2>\n<p>\u3082\u3061\u308d\u3093\u30d3\u30e5\u30fc\u3082\u307e\u3060\u4f5c\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3001<code>resources\/views\/chat.blade.php<\/code>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u5fc5\u8981\u306a\u30bf\u30b0\u3092\u3053\u3053\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;html&gt;\r\n&lt;body&gt;\r\n    &lt;div id=\"chat\"&gt;\r\n        &lt;textarea <strong>v-model=\"message\"<\/strong>&gt;&lt;\/textarea&gt;\r\n        &lt;br&gt;\r\n        &lt;button type=\"button\"&gt;\u9001\u4fe1&lt;\/button&gt;\r\n    &lt;\/div&gt;\r\n    <strong>&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.5.17\/dist\/vue.min.js\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>    &lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/0.18.0\/axios.min.js\"&gt;&lt;\/script&gt;<\/strong>\r\n    &lt;script&gt;\r\n\r\n<strong>        new Vue({\r\n            el: '#chat',\r\n            data: {\r\n                message: ''\r\n            }\r\n        });<\/strong>\r\n\r\n    &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u203b cdn\u3067<code>Vue.js<\/code>\u3001\u305d\u3057\u3066Ajax\u901a\u4fe1\u7528\u306b<code>axios<\/code>\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059\u3002<br \/>\n\u203b \u307e\u305f\u3001\u30c6\u30ad\u30b9\u30c8\u30a8\u30ea\u30a2\u306b\u306fVue\u306e<code>message<\/code>\u3068\u3044\u3046\u5909\u6570\u3092\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u3053\u306e\u60c5\u5831\u304c\u53cd\u6620\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u898b\u305f\u76ee\u306f\u3053\u3093\u306a\u98a8\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1424\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_page_1.png\" alt=\"\" width=\"179\" height=\"71\" \/><\/p>\n<h2>Ajax\u90e8\u5206\u3092\u3064\u304f\u308b<\/h2>\n<p>\u3067\u306f\u3001\u6b21\u306bAjax\u3092\u901a\u3057\u3066\u5165\u529b\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u3092<code>messages<\/code>\u30c6\u30fc\u30d6\u30eb\u306b\u4fdd\u5b58\u3059\u308b\u90e8\u5206\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u9001\u4fe1\u30dc\u30bf\u30f3\u306b\u30af\u30ea\u30c3\u30af\u30a4\u30d9\u30f3\u30c8\u3092\u8ffd\u52a0\u3057\u3066\u3001<\/p>\n<pre>&lt;button type=\"button\" <strong>@click=\"send()\"<\/strong>&gt;\u9001\u4fe1&lt;\/button&gt;<\/pre>\n<p><code>methods<\/code>\u306b\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n<pre>new Vue({\r\n    el: '#chat',\r\n    data: {\r\n        message: ''\r\n    },\r\n    methods: {\r\n<strong>        send() {<\/strong>\r\n\r\n<strong>            const url = '\/ajax\/chat';<\/strong>\r\n<strong>            const params = { message: this.message };<\/strong>\r\n<strong>            axios.post(url, params)<\/strong>\r\n<strong>                .then((response) =&gt; {<\/strong>\r\n\r\n<strong>                    \/\/ \u6210\u529f\u3057\u305f\u3089\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u30af\u30ea\u30a2<\/strong>\r\n<strong>                    this.message = '';<\/strong>\r\n\r\n<strong>                });<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n    }\r\n});<\/pre>\n<p><code>send()<\/code>\u3067\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001\u30c6\u30ad\u30b9\u30c8\u30a8\u30ea\u30a2\u306b\u5165\u529b\u3055\u308c\u305f\u5185\u5bb9\u3092Ajax\u3067\u9001\u4fe1\u3002\u305d\u3057\u3066\u3001\u767b\u9332\u304c\u6210\u529f\u3057\u305f\u3089\u30c6\u30ad\u30b9\u30c8\u30a8\u30ea\u30a2\u5185\u3092\u30af\u30ea\u30a2\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u6b21\u306bLaravel\u5074\u3067\u3053\u306eAjax\u306b\u95a2\u9023\u3059\u308b\u90e8\u5206\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30c1\u30e3\u30c3\u30c8\u306eAjax\u5c02\u7528\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan make:Controller Ajax\\\\ChatController<\/strong><\/pre>\n<p><code>app\/Http\/Controllers\/Ajax\/ChatController.php<\/code>\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u3066\u4ee5\u4e0b\uff12\u3064\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre>public function <strong>index()<\/strong> {\/\/ \u65b0\u7740\u9806\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u4e00\u89a7\u3092\u53d6\u5f97\r\n\r\n    <strong>return \\App\\Message::orderBy('id', 'desc')-&gt;get();<\/strong>\r\n\r\n}\r\n\r\npublic function <strong>create(Request $request)<\/strong> { \/\/ \u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u767b\u9332\r\n\r\n<strong>    \\App\\Message::create([\r\n        'body' =&gt; $request-&gt;message\r\n    ]);<\/strong>\r\n\r\n}<\/pre>\n<p>\u203b\u6ce8\uff1a \u672c\u6765\u306f<code>create()<\/code>\u30e1\u30bd\u30c3\u30c9\u306b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304f\u3079\u304d\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u30c6\u30b9\u30c8\u306a\u306e\u3067\u7701\u7565\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u3053\u306e\uff12\u3064\u306e\u30e1\u30bd\u30c3\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046<code>web.php<\/code>\u306bRoute\u3082\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>Route::get('ajax\/chat', 'Ajax\\ChatController@index');<\/strong> \/\/ \u30e1\u30c3\u30bb\u30fc\u30b8\u4e00\u89a7\u3092\u53d6\u5f97\r\n<strong>Route::post('ajax\/chat', 'Ajax\\ChatController@create');<\/strong> \/\/ \u30c1\u30e3\u30c3\u30c8\u767b\u9332<\/pre>\n<p>\u3067\u306f\u3001Ajax\u90e8\u5206\u306e\u6e96\u5099\u306f\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u30d5\u30a9\u30fc\u30e0\u306b\u300c\u30cf\u30ed\u30fc\uff01\u300d\u3068\u5165\u529b\u3057\u3066\u9001\u4fe1\u3057\u3001\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1425\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_page_2.png\" alt=\"\" width=\"179\" height=\"71\" \/><\/p>\n<p>\u9001\u4fe1\u3059\u308b\u3068<code>messages<\/code>\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1426\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table_3.png\" alt=\"\" width=\"521\" height=\"509\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table_3.png 521w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/messages_table_3-300x293.png 300w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><\/p>\n<p>\u3046\u307e\u304f\u30c7\u30fc\u30bf\u767b\u9332\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<h2>\u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b<\/h2>\n<p>\u3067\u306f\u3001\u6b21\u306f\u767b\u9332\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u4e00\u89a7\u3092\u8868\u793a\u3059\u308b\u90e8\u5206\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\n\u307e\u305a\u3001Vue\u306b\u5909\u6570\u3068\u3057\u3066\u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u683c\u7d0d\u3059\u308b<code>messages<\/code>\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<pre>data: {\r\n    message: '',\r\n    <strong>messages: []<\/strong>\r\n},<\/pre>\n<p>\u305d\u3057\u3066\u3001Ajax\u3092\u901a\u3057\u3066\u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d6\u5f97\u3059\u308b<code>getMessages()<\/code>\u3082\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>methods: {\r\n<strong>    getMessages() {<\/strong>\r\n\r\n<strong>        const url = '\/ajax\/chat';<\/strong>\r\n<strong>        axios.get(url)<\/strong>\r\n<strong>            .then((response) =&gt; {<\/strong>\r\n\r\n<strong>                this.messages = response.data;<\/strong>\r\n\r\n<strong>            });<\/strong>\r\n\r\n<strong>    },<\/strong>\r\n\r\n\/\/ \u4ee5\u4e0b\u7565<\/pre>\n<p>\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001<code>app\/Http\/Controllers\/Ajax\/ChatController.php<\/code>\u306e<code>index()<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u53d6\u5f97\u3057\u305f\u30c7\u30fc\u30bf\u3092<code>messages<\/code>\u306b\u683c\u7d0d\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u3059\u3050\u306b\u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b<code>mounted()<\/code>\u5185\u3067<code>getMessages()<\/code>\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>mounted() {\r\n\r\n    <strong>this.getMessages();<\/strong>\r\n\r\n}<\/pre>\n<p>\u3053\u308c\u3067\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u3001\u81ea\u52d5\u7684\u306b\u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u30c7\u30fc\u30bf\u304c\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1433\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/Screenshot-from-2018-10-10-17-08-46.png\" alt=\"\" width=\"968\" height=\"381\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/Screenshot-from-2018-10-10-17-08-46.png 968w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/Screenshot-from-2018-10-10-17-08-46-300x118.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/Screenshot-from-2018-10-10-17-08-46-768x302.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>\u3067\u306f\u3001\u6b21\u306f\u53d6\u5f97\u3057\u305f\u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u3092Vue.js\u3092\u4f7f\u3063\u3066\u8868\u793a\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>&lt;div <strong>v-for=\"m in messages\"<\/strong>&gt;\r\n\r\n    &lt;!-- \u767b\u9332\u3055\u308c\u305f\u65e5\u6642 --&gt;\r\n    &lt;span <strong>v-text=\"m.created_at\"<\/strong>&gt;&lt;\/span&gt;\uff1a&amp;nbsp;\r\n\r\n    &lt;!-- \u30e1\u30c3\u30bb\u30fc\u30b8\u5185\u5bb9 --&gt;\r\n    &lt;span <strong>v-text=\"m.body\"<\/strong>&gt;&lt;\/span&gt;\r\n\r\n&lt;\/div&gt;<\/pre>\n<p>\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001<code>v-for<\/code>\u3092\u4f7f\u3063\u3066\u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u30eb\u30fc\u30d7\u3055\u305b\u3001\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3092<code>v-text<\/code>\u3067\u53d6\u308a\u51fa\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1434\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_page_3.png\" alt=\"\" width=\"333\" height=\"268\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_page_3.png 333w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_page_3-300x241.png 300w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><\/p>\n<h1>\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u66f4\u65b0\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3055\u3041\u3001\u3084\u3063\u3068\u672c\u984c\u306b\u305f\u3069\u308a\u7740\u304d\u307e\u3057\u305f\u3002<br \/>\n\u3053\u3053\u304b\u3089<strong>Laravel Echo<\/strong>\u3092\u4f7f\u3063\u3066\u3001<\/p>\n<ol>\n<li>\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u767b\u9332\u3059\u308b<\/li>\n<li>\u81ea\u52d5\u7684\u306b\u5168\u30c1\u30e3\u30c3\u30c8\u30da\u30fc\u30b8\u3092\u66f4\u65b0\u3059\u308b<\/li>\n<\/ol>\n<p>\u3068\u3044\u3046\u90e8\u5206\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u6d41\u308c\u3068\u3057\u3066\u306f\u3001<\/p>\n<ol>\n<li>Laravel\u304b\u3089Pusher\u3078\u5909\u66f4\u304c\u3042\u3063\u305f\u3053\u3068\u3092\u901a\u77e5<\/li>\n<li>\u5f85\u6a5f\u3057\u3066\u3044\u308bLaravel Echo\u304cPusher\u3092\u901a\u3058\u3066\u5909\u66f4\u3092\u611f\u77e5<\/li>\n<li>\u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u3082\u3046\u4e00\u5ea6\u53d6\u5f97\u3057\u3066\u30da\u30fc\u30b8\u66f4\u65b0<\/li>\n<\/ol>\n<p>\u3068\u306a\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u307e\u305a<a href=\"https:\/\/pusher.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Pusher<\/a>\u306b\u767b\u9332\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>Pusher\u306b\u767b\u9332\u3059\u308b<\/h2>\n<p>\u300cSandbox plan\u300d\u3068\u547c\u3070\u308c\u308b\u30d7\u30e9\u30f3\u306f\u3001\u7121\u6599\u30d7\u30e9\u30f3\u3067\u3042\u308a\u306a\u304c\u3089\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u76f8\u5f53\u30d8\u30d3\u30fc\u306a\u4f7f\u3044\u65b9\u3082\u3067\u304d\u308b\u4ed5\u69d8\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\uff082018\/10\/10\u73fe\u5728\uff09<\/p>\n<ul>\n<li>\u6700\u5927100\u63a5\u7d9a<\/li>\n<li>\u30c1\u30e3\u30f3\u30cd\u30eb\u6570\u306f\u7121\u5236\u9650<\/li>\n<li>1\u65e5\u306b200,000\u56de\u30e1\u30c3\u30bb\u30fc\u30b8\u307e\u3067<\/li>\n<li>\u3061\u3087\u3063\u3068\u3057\u305f\u30b5\u30dd\u30fc\u30c8\u3042\u308a<\/li>\n<li>SSL\u3067\u6697\u53f7\u5316<\/li>\n<\/ul>\n<p>\u3067\u306f\u767b\u9332\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a<a href=\"https:\/\/dashboard.pusher.com\/accounts\/sign_up\" target=\"_blank\" rel=\"noopener noreferrer\">\u767b\u9332\u30da\u30fc\u30b8<\/a>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3001<\/p>\n<ul>\n<li>\u3042\u306a\u305f\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9<\/li>\n<li>\u30d1\u30b9\u30ef\u30fc\u30c9<\/li>\n<li>\u7d44\u7e54\u540d<\/li>\n<\/ul>\n<p>\u3092\u5165\u529b\u3057\u3066<strong>\u300cCREATE A FREE ACCOUNT\u300d<\/strong>\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1436\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_2.png\" alt=\"\" width=\"1343\" height=\"721\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_2.png 1343w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_2-300x161.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_2-768x412.png 768w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_2-1024x550.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u672c\u767b\u9332\u3092\u4fc3\u3059\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u3067\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1437\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_3.png\" alt=\"\" width=\"395\" height=\"187\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_3.png 395w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_3-300x142.png 300w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\" \/><\/p>\n<p>\u672c\u767b\u9332\u306eURL\u304c\u30e1\u30fc\u30eb\u306b\u5c4a\u3044\u3066\u3044\u308b\u306e\u3067\u3001\u300cConfirm my account\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066Pusher\u3078\u306e\u4f1a\u54e1\u767b\u9332\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1438\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_4.png\" alt=\"\" width=\"462\" height=\"134\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_4.png 462w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_4-300x87.png 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/p>\n<p>\u3061\u306a\u307f\u306b\u4ee5\u4e0b\u304c\u767b\u9332\u304c\u5b8c\u4e86\u3057\u305f\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1439\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_5.png\" alt=\"\" width=\"394\" height=\"138\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_5.png 394w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_signup_5-300x105.png 300w\" sizes=\"auto, (max-width: 394px) 100vw, 394px\" \/><\/p>\n<p>\u3067\u306f\u3001<a href=\"https:\/\/dashboard.pusher.com\/accounts\/sign_in\" target=\"_blank\" rel=\"noopener noreferrer\">\u30ed\u30b0\u30a4\u30f3\u30da\u30fc\u30b8<\/a>\u304b\u3089\u767b\u9332\u3057\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u4f7f\u3063\u3066\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1440\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_1.png\" alt=\"\" width=\"381\" height=\"280\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_1.png 381w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_1-300x220.png 300w\" sizes=\"auto, (max-width: 381px) 100vw, 381px\" \/><\/p>\n<p>\u3059\u308b\u3068\u521d\u56de\u30ed\u30b0\u30a4\u30f3\u6642\u306f\u89aa\u5207\u306b\u3082\u3059\u3050\u5229\u7528\u3059\u308b\u30b5\u30a4\u30c8\u3092\u767b\u9332\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u3067\u3001<\/p>\n<ul>\n<li>Name your app\u3000\u30fb\u30fb\u30fb\u3000\u30a2\u30d7\u30ea\uff08\u30b5\u30a4\u30c8\uff09\u540d<\/li>\n<li>Select a cluster\u3000\u30fb\u30fb\u30fb\u3000\u304a\u305d\u3089\u304f\u30b7\u30f3\u30ac\u30dd\u30fc\u30eb\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u307e\u307e\u3067OK\u3002<\/li>\n<\/ul>\n<p>\u3092\u5165\u529b\u3057\u3066\u300cCreate my app\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-1442\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_2.png\" alt=\"\" width=\"646\" height=\"688\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_2.png 646w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_2-282x300.png 282w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>\u3053\u308c\u3067\u3001\u30b5\u30a4\u30c8\u306e\u767b\u9332\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>Laravel\u5074\u3067\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8\u306e\u6e96\u5099\u3092\u3059\u308b<\/h2>\n<p>\u3067\u306f\u3001\u6b21\u306bLaravel\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u901a\u77e5\u304c\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br \/>\nPusher\u306e\u300cApp Keys\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u63a5\u7d9a\u60c5\u5831\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1444\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_3.png\" alt=\"\" width=\"578\" height=\"400\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_3.png 578w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_3-300x208.png 300w\" sizes=\"auto, (max-width: 578px) 100vw, 578px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u308c\u3089\u306e\u60c5\u5831\u3092<code>.env<\/code>\u306b\u66f8\u304d\u8fbc\u3093\u3067\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>PUSHER_APP_ID=******\r\nPUSHER_APP_KEY=********************\r\nPUSHER_APP_SECRET=********************\r\nPUSHER_APP_CLUSTER=***<\/pre>\n<p>\u305d\u3057\u3066\u3001\u30d6\u30ed\u30fc\u30c9\u30ad\u30e3\u30b9\u30c8\u306b\u306fPusher\u3092\u4f7f\u3046\u306e\u3067\u3001\u540c\u3058\u304f<code>.env<\/code>\u5185\u306e<code>BROADCAST_DRIVER<\/code>\u306f<code>pusher<\/code>\u3078\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>BROADCAST_DRIVER=<strong>pusher<\/strong><\/pre>\n<p>\u307e\u305f\u3001<code>config\/app.php<\/code>\u5185\u306b\u3042\u308b<code>BroadcastServiceProvider<\/code>\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u30b3\u30e1\u30f3\u30c8\u5316\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u308c\u3092\u89e3\u9664\u3057\u3066\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre>\/*\r\n * Application Service Providers...\r\n *\/\r\nApp\\Providers\\AppServiceProvider::class,\r\nApp\\Providers\\AuthServiceProvider::class,\r\n<strong>\/\/ App\\Providers\\BroadcastServiceProvider::class,<\/strong>\r\nApp\\Providers\\EventServiceProvider::class,\r\nApp\\Providers\\RouteServiceProvider::class,<\/pre>\n<p>\u89e3\u9664\u3059\u308b\u3068\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>App\\Providers\\AppServiceProvider::class,\r\nApp\\Providers\\AuthServiceProvider::class,\r\nApp\\Providers\\BroadcastServiceProvider::class, <strong>\/\/ \u2190\u3053\u3053\u3092\u89e3\u9664\u3057\u307e\u3057\u305f<\/strong>\r\nApp\\Providers\\EventServiceProvider::class,\r\nApp\\Providers\\RouteServiceProvider::class,<\/pre>\n<p>\u305f\u3060\u3057\u3001\u3053\u306e\u307e\u307e\u306e\u72b6\u614b\u3067\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1445\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_4.png\" alt=\"\" width=\"416\" height=\"172\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_4.png 416w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_setting_4-300x124.png 300w\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" \/><\/p>\n<p>\u3068\u3044\u3046\u5177\u5408\u306bPusher\u7528\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u306a\u3044\u3068\u8a00\u308f\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u5c02\u7528\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>composer require pusher\/pusher-php-server \"~3.0\"<\/strong><\/pre>\n<p>\u3067\u306f\u3001\u6b21\u306bPusher\u3068\u306e\u3064\u306a\u304e\u5f79\u3092\u3057\u3066\u304f\u308c\u308b<strong>Laravel Echo\uff08JavaScript\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\uff09<\/strong>\u3092\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\uff08\u3082\u3057\u307e\u3060npm\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5168\u304f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001<code>npm install<\/code>\u3067\u521d\u671f\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<pre><strong>npm install --save laravel-echo pusher-js<\/strong><\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001<code>resources\/js\/bootstrap.js<\/code>\u3092\u958b\u3044\u3066\u3001Laravel Echo\u306b\u95a2\u3059\u308b\u30b3\u30fc\u30c9\u306e\u30b3\u30e1\u30f3\u30c8\u5316\u3092\u89e3\u9664\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>import Echo from 'laravel-echo'\r\n\r\nwindow.Pusher = require('pusher-js');\r\n\r\nwindow.Echo = new Echo({\r\n    broadcaster: 'pusher',\r\n    key: process.env.MIX_PUSHER_APP_KEY,\r\n    cluster: process.env.MIX_PUSHER_APP_CLUSTER,\r\n    encrypted: true\r\n});<\/strong><\/pre>\n<p>\u203b\u4e0a\u306e\u30b3\u30fc\u30c9\u306f\u521d\u671f\u72b6\u614b\u3067\u5168\u3066\u30b3\u30e1\u30f3\u30c8\u5316\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u89e3\u9664\u3057\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30d3\u30eb\u30c9\u3057\u3066<code>app.js<\/code>\u3092\u66f4\u65b0\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>npm run dev<\/strong><\/pre>\n<p>\u30d3\u30eb\u30c9\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u518d\u3073<code>resources\/views\/chat.blade.php<\/code>\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3053\u308c\u307e\u3067\u4f7f\u3063\u3066\u304d\u305f<code>vue<\/code>\u3068<code>axios<\/code>\u306f<code>\/js\/app.js<\/code>\u3067\u5168\u3066\u4ee3\u66ff\u304c\u3067\u304d\u308b\u306e\u3067\u305d\u3063\u304f\u308a\u5165\u308c\u66ff\u3048\u307e\u3059\u3002<\/p>\n<pre>&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/vue@2.5.17\/dist\/vue.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/0.18.0\/axios.min.js\"&gt;&lt;\/script&gt;<\/pre>\n<p>\u2193\u2193\u2193\u5165\u308c\u66ff\u3048\u308b<\/p>\n<pre><strong>&lt;script src=\"\/js\/app.js\"&gt;&lt;\/script&gt;<\/strong><\/pre>\n<p>\u3067\u306f\u3053\u306e\u72b6\u614b\u3067\u4e00\u5ea6\u30c1\u30e3\u30c3\u30c8\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u901a\u4fe1\u72b6\u614b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1447\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/laravel_echo_1.png\" alt=\"\" width=\"953\" height=\"166\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/laravel_echo_1.png 953w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/laravel_echo_1-300x52.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/laravel_echo_1-768x134.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p><code>websocket<\/code>\u306e\u901a\u4fe1\u304c\u73fe\u308c\u307e\u3057\u305f\u3002<\/p>\n<h2>\u901a\u77e5\u30a4\u30d9\u30f3\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u3042\u3068\u5c11\u3057\u3068\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3067\u306f\u3001\u6b21\u306b<code>messages<\/code>\u30c6\u30fc\u30d6\u30eb\u306b\u65b0\u898f\u767b\u9332\u3055\u308c\u305f\u3089Pusher\u306b\u305d\u306e\u5185\u5bb9\u3092\u9001\u4fe1\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u5c02\u7528\u30a4\u30d9\u30f3\u30c8<code>MessageCreated<\/code>\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan make:event MessageCreated<\/strong><\/pre>\n<p>\u305d\u3057\u3066\u3001\u4f5c\u6210\u3055\u308c\u305f<code>app\/Events\/MessageCreated.php<\/code>\u3092\u958b\u3044\u3066\u3001<code>ShouldBroadcast<\/code>\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3092\u5b9f\u88c5\u3002\u305d\u3057\u3066\u3001\u3055\u3089\u306b\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u30e1\u30f3\u30d0\u5909\u6570<code>$message<\/code>\u306b\u767b\u9332\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3057\u307e\u3059\uff08Pusher\u306f\u901a\u77e5\u3059\u308b\u306b\u306f\u3001<code>public<\/code>\u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff09<\/p>\n<p>\u307e\u305f\u3001<code>broadcastOn()<\/code>\u306e\u4e2d\u3067\u3001\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u901a\u5e38\u306e<code>new\u00a0Channel<\/code>\u306b\u3057\u3001\u540d\u3092<code>chat<\/code>\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre>&lt;?php\r\n\r\nnamespace App\\Events;\r\n\r\nuse App\\Message;\r\nuse Illuminate\\Broadcasting\\Channel;\r\nuse Illuminate\\Queue\\SerializesModels;\r\nuse Illuminate\\Broadcasting\\PrivateChannel;\r\nuse Illuminate\\Broadcasting\\PresenceChannel;\r\nuse Illuminate\\Foundation\\Events\\Dispatchable;\r\nuse Illuminate\\Broadcasting\\InteractsWithSockets;\r\nuse Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast;\r\n\r\nclass MessageCreated<strong> implements ShouldBroadcast<\/strong>\r\n{\r\n    use Dispatchable, InteractsWithSockets, SerializesModels;\r\n\r\n    <strong>public $message;<\/strong>\r\n\r\n    \/**\r\n     * Create a new event instance.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function __construct(<strong>Message $message<\/strong>)\r\n    {\r\n        <strong>$this-&gt;message = $message;<\/strong>\r\n    }\r\n\r\n    \/**\r\n     * Get the channels the event should broadcast on.\r\n     *\r\n     * @return \\Illuminate\\Broadcasting\\Channel|array\r\n     *\/\r\n    public function broadcastOn()\r\n    {\r\n        <strong>return new Channel('chat');<\/strong>\r\n    }\r\n}<\/pre>\n<p>\u203b \u592a\u5b57\u304c\u5909\u66f4\u3057\u305f\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u767b\u9332\u3055\u308c\u305f\u3089<code>MessageCreated<\/code>\u304c\u81ea\u52d5\u7684\u306b\u5b9f\u884c\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>app\/Http\/Controllers\/Ajax\/ChatController.php<\/code>\u306e<code>create()<\/code>\u3067\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre>public function create(Request $request) {\r\n\r\n    <strong>$message<\/strong> = \\App\\Message::create([\r\n        'body' =&gt; $request-&gt;message\r\n    ]);\r\n    <strong>event(new MessageCreated($message));<\/strong>\r\n\r\n}<\/pre>\n<p>\u203b \u30e2\u30c7\u30eb\u306e<code>$dispatchesEvents<\/code>\u306b\u8a2d\u5b9a\u3057\u3066\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u305f\u969b\u306b\u3082\u3053\u306e\u30a4\u30d9\u30f3\u30c8\u304c\u547c\u3070\u308c\u3066\u3057\u307e\u3046\u95a2\u4fc2\u304b\u3089\u3053\u306e\u5f62\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3053\u306e\u72b6\u614b\u3067\u4e00\u5ea6\u767b\u9332\u30c7\u30fc\u30bf\u304cPusher\u306b\u9001\u4fe1\u3055\u308c\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001Pusher\u306e\u300c<strong>Debug Console<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u8868\u793a\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1449\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_test_1.png\" alt=\"\" width=\"697\" height=\"119\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_test_1.png 697w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_test_1-300x51.png 300w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u30c1\u30e3\u30c3\u30c8\u30da\u30fc\u30b8\u306b\u4eca\u5ea6\u306f\u300c\u30a2\u30ed\u30cf\u30fc\uff01\u300d\u3068\u5165\u529b\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-1450\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_page_4.png\" alt=\"\" width=\"326\" height=\"268\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_page_4.png 326w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_page_4-300x247.png 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001Pusher\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u4ee5\u4e0b\u306e\u5185\u5bb9\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1451\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_test_2.png\" alt=\"\" width=\"804\" height=\"387\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_test_2.png 804w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_test_2-300x144.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/pusher_test_2-768x370.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/p>\n<p>\u9001\u4fe1\u6210\u529f\u3067\u3059\uff01<\/p>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306bPusher\u304b\u3089\u306e\u901a\u77e5\u3092\u5f85\u6a5f\u3059\u308bLaravel Echo\u306e\u30b3\u30fc\u30c9\u3092Vue\u306e<code>mounted()<\/code>\u5185\u306b\u8ffd\u52a0\u3057\u3066\u4f5c\u696d\u306f\u7d42\u4e86\u3067\u3059\u3002<\/p>\n<pre>mounted() {\r\n\r\n    this.getMessages();\r\n\r\n<strong>    Echo.channel('chat')<\/strong>\r\n<strong>        .listen('MessageCreated', (e) =&gt; {<\/strong>\r\n\r\n<strong>            this.getMessages(); \/\/ \u5168\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u518d\u8aad\u8fbc<\/strong>\r\n\r\n<strong>        });<\/strong>\r\n\r\n}<\/pre>\n<p>\u3067\u306f\u3001\u5927\u5909\u9577\u3089\u304f\u304a\u5f85\u305f\u305b\u3057\u307e\u3057\u305f\uff01<\/p>\n<p>\u7dca\u5f35\u306e\u30c1\u30e3\u30c3\u30c8\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u30c1\u30e3\u30c3\u30c8\u30da\u30fc\u30b8\u3092\uff12\u3064\u958b\u3044\u3066\u3001\u7247\u65b9\u304b\u3089\u300c\u30dc\u30f3\u30b8\u30e5\u30fc\u30eb\uff01\u300d\u3068\u9001\u4fe1\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1453\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_test_1.png\" alt=\"\" width=\"591\" height=\"370\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_test_1.png 591w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_test_1-300x188.png 300w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/p>\n<p>\u3055\u3041\u3001\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u304b\uff1f\uff1f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1452\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_test_2.png\" alt=\"\" width=\"585\" height=\"379\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_test_2.png 585w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/10\/chat_test_2-300x194.png 300w\" sizes=\"auto, (max-width: 585px) 100vw, 585px\" \/><\/p>\n<p>\u3046\u307e\u304f\u66f4\u65b0\u3055\u308c\u307e\u3057\u305f\uff01<\/p>\n<p>\u753b\u50cf\u3067\u306f\u308f\u304b\u308a\u306b\u304f\u3044\u3067\u3059\u304c\u3001\u5de6\u5074\u306e\u753b\u9762\u306f\u4f55\u3082\u89e6\u3063\u3066\u3044\u306a\u3044\u3067\u3059\u304c\u3001\u81ea\u52d5\u7684\u306b\u66f4\u65b0\u3055\u308c\u3066\u300c\u30dc\u30f3\u30b8\u30e5\u30fc\u30eb\uff01\u300d\u3068\u3044\u3046\u6587\u5b57\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u3082\u3061\u308d\u3093\u9006\u5074\u304b\u3089\u3082\u540c\u3058\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u3067Laravel\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30fb\u30c1\u30e3\u30c3\u30c8\u3092\u4f5c\u308b\u65b9\u6cd5\u3067\u3057\u305f\u3002<\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\uff01<\/p>\n<h1>\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/h1>\n<p>\u4eca\u56de\u306e\u8aac\u660e\u3067\u4f5c\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u4e00\u5f0f\u3092\u4ee5\u4e0b\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u203b \u305f\u3060\u3057\u3001\u4ee5\u4e0b\u306e\u9805\u76ee\u306f\u3054\u81ea\u8eab\u3067\u884c\u3063\u3066\u3044\u305f\u3060\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>config\/app.php<\/code>\u306e<code>BroadcastServiceProvider<\/code>\u3092\u89e3\u9664<\/li>\n<li><code>.env<\/code>\u306e\u7de8\u96c6<\/li>\n<li><code>app.js<\/code>\u306e\u30d3\u30eb\u30c9<\/li>\n<\/ul>\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link\" title=\"\" href=\"https:\/\/blog.capilano-fw.com?download=1455&amp;tmstv=1777535348\" rel=\"nofollow\" id=\"download-link-1455\" data-redirect=\"false\" >\n\tLaravel\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30fb\u30c1\u30e3\u30c3\u30c8\u3092\u4f5c\u308b\u30d5\u30a1\u30a4\u30eb\u4e00\u5f0f<\/a>\n\n<h1>Pusher\u3078\u30c7\u30fc\u30bf\u9001\u4fe1\u304c\u3067\u304d\u306a\u3044\u5834\u5408\uff08\u8ffd\u8a18\uff1a 2019.06.03\uff09<\/h1>\n<p>\u8a2a\u554f\u8005\u69d8\u304b\u3089\u3054\u9023\u7d61\u3092\u3044\u305f\u3060\u3044\u3066\u77e5\u3063\u305f\u3053\u3068\u306a\u306e\u3067\u3059\u304c\u3001\u3069\u3046\u3084\u3089\u74b0\u5883\uff08\u304a\u305d\u3089\u304fPHP\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5f71\u97ff\u304b\u3068\u601d\u308f\u308c\u307e\u3059\uff09\u304c\u9055\u3046\u3068Pusher\u5074\u306b\u30c7\u30fc\u30bf\u9001\u4fe1\u304c\u3067\u304d\u306a\u3044\u30b1\u30fc\u30b9\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u3082\u3057\u3053\u306e\u72b6\u6cc1\u306b\u306a\u3063\u305f\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067<code>encrypted<\/code>\u3092\u89e3\u9664\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u307e\u305a\u3001<code>\/config\/broadcasting.php<\/code>\u306e<code>encrypted<\/code>\u3092<code>false<\/code>\u3078\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>'connections' =&gt; [\r\n\r\n    'pusher' =&gt; [\r\n        'driver' =&gt; 'pusher',\r\n        'key' =&gt; env('PUSHER_APP_KEY'),\r\n        'secret' =&gt; env('PUSHER_APP_SECRET'),\r\n        'app_id' =&gt; env('PUSHER_APP_ID'),\r\n        'options' =&gt; [\r\n            'cluster' =&gt; env('PUSHER_APP_CLUSTER'),\r\n            'encrypted' =&gt; <strong>false<\/strong>,\r\n        ],\r\n    ],\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<p>\u305d\u3057\u3066\u3001<code>\/resouces\/js\/bootstrap.js<\/code>\u3082\u540c\u69d8\u306b<code>encrypted<\/code>\u3092<code>false<\/code>\u3078\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre>window.Echo = new Echo({\r\n    broadcaster: 'pusher',\r\n    key: process.env.MIX_PUSHER_APP_KEY,\r\n    cluster: process.env.MIX_PUSHER_APP_CLUSTER,\r\n    encrypted: <strong>false<\/strong>\r\n});<\/pre>\n<p>\u3055\u3089\u306b\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u30d3\u30eb\u30c9\u3057\u306a\u3044\u3068\u4f7f\u3048\u307e\u305b\u3093\u306e\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>npm run dev<\/strong>\r\n\r\n# \u3082\u3057\u304f\u306f\r\n\r\n<strong>npm run production<\/strong><\/pre>\n<p>\u4ee5\u4e0a\u3067\u3059\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001Laravel\u306e\u6a5f\u80fd\u306f\u6642\u9593\u3092\u8ffd\u3046\u3054\u3068\u306b\u3069\u3093\u3069\u3093\u5897\u3048\u3066\u3044\u3063\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u3055\u3059\u304c\u4e16\u754c\u4e2d\u306e\u512a\u79c0\u306a\u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u305f\u3061\u304c\u65b0\u3057\u3044\u4fbf\u5229\u306a\u6a5f\u80fd\u3092\u30d7\u30eb\u30ea\u30af\u30a8\u30b9\u30c8\u3057\u3066\u3044 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=1418\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel+Vue\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30fb\u30c1\u30e3\u30c3\u30c8\u3092\u3064\u304f\u308b\uff08\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u53ef\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":1460,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,12,97],"tags":[91],"class_list":["post-1418","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","category-vue-js","category-97","tag-91"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/1418","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=1418"}],"version-history":[{"count":16,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/1418\/revisions"}],"predecessor-version":[{"id":1713,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/1418\/revisions\/1713"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/1460"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}