{"id":12196,"date":"2023-12-17T07:00:58","date_gmt":"2023-12-16T22:00:58","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=12196"},"modified":"2023-11-24T18:34:53","modified_gmt":"2023-11-24T09:34:53","slug":"laravel-pusher-%e3%81%a7%e3%83%aa%e3%82%a2%e3%83%ab%e3%82%bf%e3%82%a4%e3%83%a0%e3%81%aa%e4%bd%8d%e7%bd%ae%e6%83%85%e5%a0%b1%e3%81%ae%e5%85%b1%e6%9c%89%e3%82%b7%e3%82%b9%e3%83%86%e3%83%a0%e3%82%92","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=12196","title":{"rendered":"Laravel + Pusher \u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u4f4d\u7f6e\u60c5\u5831\u306e\u5171\u6709\u30b7\u30b9\u30c6\u30e0\u3092\u3064\u304f\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u308c\u306f\u500b\u4eba\u7684\u306b\u306f\u300c<strong>\u3048\u3001\u305d\u3053\u307e\u3067\u3059\u308b\u3093\u3060\u2026\ud83d\ude05<\/strong>\u300d\u3068\u3044\u3046\u6c17\u6301\u3061\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u3042\u308b\u300c\u30b0\u30eb\u30fc\u30d7\u5185\u3067\u5229\u7528\u3055\u308c\u308b\u3068\u8a00\u308f\u308c\u308b\u300d\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u304c\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u4f4d\u7f6e\u60c5\u5831\u306e\u5171\u6709\u30b7\u30b9\u30c6\u30e0<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u7279\u5b9a\u306e\u30b0\u30eb\u30fc\u30d7\u3084\u30ab\u30c3\u30d7\u30eb\u9593\u3067\u300c<strong>\u3042\u3001\u4eca A\u3055\u3093\u306f\u99c5\u306b\u3044\u308b\u306a<\/strong>\u300d\u3068\u3044\u3046\u306e\u304c\u5206\u304b\u308b\u30b7\u30b9\u30c6\u30e0\u3067\u3059\u3002<\/p>\n<p>\u500b\u4eba\u7684\u306b\u306f\uff08\u3084\u307e\u3057\u3044\u3053\u3068\u306f\u3057\u3066\u307e\u305b\u3093\u304c\u2757\uff09\u81ea\u5206\u306e\u4f4d\u7f6e\u60c5\u5831\u3092\u8ab0\u304b\u3068\u30b7\u30a7\u30a2\u3055\u308c\u308b\u306e\u306f\u7aae\u5c48\u306a\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u304c\u3001\u707d\u5bb3\u6642\u3092\u60f3\u5b9a\u3057\u305f\u3082\u306e\u3082\u3042\u308b\u3088\u3046\u3067\u4f7f\u3044\u65b9\u6b21\u7b2c\u306a\u306e\u304b\u306a\u3068\u3044\u3046\u5370\u8c61\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f\u300c<strong>Laravel + Alpine.js<\/strong>\u300d\u3092\u4f7f\u3063\u3066\u3053\u306e\u300c<strong>\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u4f4d\u7f6e\u60c5\u5831\u306e\u5171\u6709\u30b7\u30b9\u30c6\u30e0<\/strong>\u300d\u3092\u3064\u304f\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002\ud83d\ude04\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11002 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/09\/no_10.png\" alt=\"\" width=\"370\" height=\"290\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/09\/no_10.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2022\/09\/no_10-300x235.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u30d5\u30a1\u30df\u30b3\u30f3\u30df\u30cb\u306e\u672a\u4f7f\u7528\u30fb\u65b0\u54c1\u304c<br \/>\n\u30d7\u30ec\u30df\u30a2\u304c\u3064\u3044\u3066<br \/>\n50,000\u5186 \u3067\u58f2\u3089\u308c\u3066\u307e\u3057\u305f \ud83d\ude2f\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 10.x\u3001Alpine.js<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u4f4d\u7f6e\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u3042\u3063\u3066\u3082<code>https<\/code>\u63a5\u7d9a\u304c\u5fc5\u8981\u3067\u3059\u3002\uff08\u3061\u306a\u307f\u306b\u3001<code>self.crypto.randomUUID()<\/code>\u00a0\u3082\u3067\u3059\uff09<\/p>\n<p>\u5148\u306b\u74b0\u5883\u3092\u6574\u3048\u3066\u304b\u3089\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002\ud83d\ude04\ud83d\udc4d<\/p>\n<p>\u307e\u305f\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u5bfe\u5fdc\u3059\u308b\u305f\u3081\u306b <strong><a href=\"https:\/\/pusher.com\/\" target=\"_blank\" rel=\"noopener\">Pusher<\/a><\/strong> \u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u3061\u3089\u3082\uff08\u3061\u3087\u3063\u3068\u53e4\u3044\u8a18\u4e8b\u3067\u3059\u304c\uff09\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u53c2\u8003\u306b\u3057\u3066<code>Pusher<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u30ad\u30fc\u3092\u53d6\u5f97\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003\u30da\u30fc\u30b8\uff1a<\/strong>\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=1418#i-6\" target=\"_blank\" rel=\"noopener\">\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u66f4\u65b0\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u308b<\/a><\/p>\n<h1>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p>\u307e\u305a\u306f\u4eca\u56de\u5fc5\u8981\u306b\u306a\u308b\u4ee5\u4e0b\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5148\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<div>\n<pre><strong>composer require pusher\/pusher-php-server<\/strong><\/pre>\n<div>\n<pre><strong>npm install --save-dev laravel-echo pusher-js leaflet<\/strong><\/pre>\n<\/div>\n<\/div>\n<h1>Laravel Echo \u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<p><code>Pusher<\/code>\u306f<code>Laravel Echo<\/code>\u3092\u4f7f\u3063\u3066\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u521d\u671f\u72b6\u614b\u3067\u306f\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u6709\u52b9\u306b\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001<code>Pusher<\/code>\u3067\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u4f5c\u3063\u305f\u3089<code>.env<\/code>\u306e\u4ee5\u4e0b\u306e\u90e8\u5206\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>.env<\/strong><\/p>\n<div>\n<pre><strong>BROADCAST_DRIVER=pusher<\/strong>\r\n\r\n\/\/ \u7701\u7565\r\n\r\n<strong>PUSHER_APP_ID=*******************<\/strong>\r\n<strong>PUSHER_APP_KEY=*******************<\/strong>\r\n<strong>PUSHER_APP_SECRET=*******************<\/strong>\r\n\r\n\/\/ \u7701\u7565\r\n\r\n<strong>PUSHER_APP_CLUSTER=ap3<\/strong><\/pre>\n<p><code>Laravel Echo<\/code>\u306e\u300c<strong>\u3059\u3067\u306b\u30b3\u30fc\u30c9\u306f\u5b58\u5728\u3057\u3066\u3044\u308b\u3051\u3069\u3001\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3055\u308c\u3066\u3044\u308b\u90e8\u5206<\/strong>\u300d\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u89e3\u9664\u3057\u307e\u3059\u3002<\/p>\n<p><strong>resources\/js\/bootstrap.js<\/strong><\/p>\n<div>\n<pre>\/\/ \u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u521d\u671f\u72b6\u614b\u3067\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3055\u308c\u3066\u307e\u3059\u304c\u89e3\u9664\u3057\u307e\u3059\r\n\r\n<strong>import Echo from 'laravel-echo';<\/strong>\r\n\r\n<strong>import Pusher from 'pusher-js';<\/strong>\r\n<strong>window.Pusher = Pusher;<\/strong>\r\n\r\n<strong>window.Echo = new Echo({<\/strong>\r\n<strong>    broadcaster: 'pusher',<\/strong>\r\n<strong>    key: import.meta.env.VITE_PUSHER_APP_KEY,<\/strong>\r\n<strong>    cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',<\/strong>\r\n<strong>    wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,<\/strong>\r\n<strong>    wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,<\/strong>\r\n<strong>    wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,<\/strong>\r\n<strong>    forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',<\/strong>\r\n<strong>    enabledTransports: ['ws', 'wss'],\r\n    authEndpoint: '\/user_location\/auth', \/\/ \ud83d\udc48 \u72ec\u81ea\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n<strong>});<\/strong><\/pre>\n<p><span style=\"font-size: 1rem;\">\u203b \u3061\u306a\u307f\u306b\u3001\u4eca\u56de\u306f\u8a18\u4e8b\u304c\u8907\u96d1\u306b\u306a\u308a\u3059\u304e\u3066\u3057\u307e\u3046\u3068\u601d\u3063\u305f\u306e\u3067\u3001\u72ec\u81ea\u306e\u8a8d\u8a3c\u7528\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u8ffd\u52a0\u3057\u3066\uff11\u3064\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5185\u3067\u5b8c\u7d50\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>\u306a\u304a\u3001\u8a8d\u8a3c\u7528\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306f<code>CSRF<\/code>\u30c8\u30fc\u30af\u30f3\u306e\u30c1\u30a7\u30c3\u30af\u3092\u5916\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Middleware\/VerifyCsrfToken.php<\/strong><\/p>\n<div>\n<pre>&lt;?php\r\n\r\nnamespace App\\Http\\Middleware;\r\n\r\nuse Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken as Middleware;\r\n\r\nclass VerifyCsrfToken extends Middleware\r\n{\r\n    \/**\r\n     * The URIs that should be excluded from CSRF verification.\r\n     *\r\n     * @var array&lt;int, string&gt;\r\n     *\/\r\n    protected $except = [\r\n        <strong>'user_location\/auth', \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n    ];\r\n}<\/pre>\n<h1>Leaflet \u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<p><code>Leaflet<\/code>\u306f\u5730\u56f3\u306e\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u304c\u3001\u3053\u308c\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3060\u3051\u3067\u306f\u6709\u52b9\u306b\u306f\u306a\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u5148\u307b\u3069\u306e<code>Laravel Echo<\/code>\u306e\u4e0b\u3042\u305f\u308a\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><strong>resources\/js\/bootstrap.js<\/strong><\/p>\n<div>\n<pre>\/\/ \u7701\u7565\r\n\r\n\/\/ \u5730\u56f3\r\n<strong>import L from 'leaflet';<\/strong>\r\n<strong>import 'leaflet\/dist\/leaflet.css';<\/strong>\r\n<strong>import markerIcon from 'leaflet\/dist\/images\/marker-icon.png';<\/strong>\r\n<strong>window.markerIcon = markerIcon;<\/strong><\/pre>\n<\/div>\n<h1>\u30d3\u30eb\u30c9\u3059\u308b<\/h1>\n<\/div>\n<p>\u3067\u306f\u3001\u6e96\u5099\u304c\u6574\u3044\u307e\u3057\u305f\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30d3\u30eb\u30c9\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<div>\n<pre><strong>npm run build<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u4ee5\u4e0b\u3092<code>blade<\/code>\u5185\u306b\u30bb\u30c3\u30c8\u3059\u308c\u3070\u81ea\u52d5\u7684\u306b\u30d3\u30eb\u30c9\u3057\u305f<code>js<\/code>\u3084<code>css<\/code>\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u3001\u5148\u307b\u3069\u306e<code>Laravel Echo<\/code>\u3084<code>Leaflet<\/code>\u3060\u3051\u3067\u306a\u304f\u3001<code>axios<\/code>\u3084<code>Alpine.js<\/code>\u3082\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div>\n<pre><strong>@vite(['resources\/css\/app.css', 'resources\/js\/app.js'])<\/strong><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h1>\u30e2\u30c7\u30eb\uff06\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5468\u308a\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:model UserLocation -m<\/strong><\/pre>\n<\/div>\n<p>\u3059\u308b\u3068\uff12\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Models\/UserLocation.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Models;<\/strong>\r\n\r\n<strong>use Illuminate\\Database\\Eloquent\\Factories\\HasFactory;<\/strong>\r\n<strong>use Illuminate\\Database\\Eloquent\\Model;<\/strong>\r\n<strong>use Illuminate\\Support\\Str;<\/strong>\r\n\r\n<strong>class UserLocation extends Model<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    use HasFactory;<\/strong>\r\n\r\n<strong>    protected $fillable = [<\/strong>\r\n<strong>        'uuid',<\/strong>\r\n<strong>        'name',<\/strong>\r\n<strong>        'latitude',<\/strong>\r\n<strong>        'longitude',<\/strong>\r\n<strong>    ];<\/strong>\r\n\r\n<strong>    \/\/ Accessor<\/strong>\r\n<strong>    public function getNameAttribute($value)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return (Str::length($value) === 0) ? '\u540d\u524d\u306a\u3057' : $value;<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<p><strong>database\/migrations\/****_**_**_******_create_user_locations_table.php<\/strong><\/p>\n<div>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up(): void\r\n{\r\n    Schema::create('user_locations', function (Blueprint $table) {\r\n        <strong>$table-&gt;id();<\/strong>\r\n<strong>        $table-&gt;uuid('uuid')-&gt;unique()-&gt;comment('UUID');<\/strong>\r\n<strong>        $table-&gt;string('name')-&gt;nullable()-&gt;comment('\u540d\u524d');<\/strong>\r\n<strong>        $table-&gt;decimal('latitude', 10, 7)-&gt;comment('\u7def\u5ea6');<\/strong>\r\n<strong>        $table-&gt;decimal('longitude', 10, 7)-&gt;comment('\u7d4c\u5ea6');<\/strong>\r\n<strong>        $table-&gt;timestamps();<\/strong>\r\n    });\r\n}\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<\/div>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\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<div>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<\/div>\n<p>\u3059\u308b\u3068\u3001\u5b9f\u969b\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12202\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_1.png\" alt=\"\" width=\"369\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_1.png 369w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_1-300x252.png 300w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><\/p>\n<h1>\u4f4d\u7f6e\u30c7\u30fc\u30bf\u306e\u305f\u3081\u306e\u72ec\u81ea\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4f5c\u6210\u3059\u308b\u524d\u306b\u3001\u4f4d\u7f6e\u60c5\u5831\uff08\u4f8b\uff1a <code>35.710054<\/code>\u3001 <code>139.811226<\/code>\uff09\u304c\u6b63\u3057\u3044\u5f62\u5f0f\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u72ec\u81ea\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30fb\u30eb\u30fc\u30eb\u3092\u3064\u304f\u3063\u3066\u304a\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<div>\n<pre><strong>php artisan make:rule Location<\/strong><\/pre>\n<\/div>\n<p>\u3059\u308b\u3068\u3001<code>app\/Rules<\/code>\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Rules\/Location.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Rules;<\/strong>\r\n\r\n<strong>use Closure;<\/strong>\r\n<strong>use Illuminate\\Contracts\\Validation\\ValidationRule;<\/strong>\r\n\r\n<strong>class Location implements ValidationRule<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    public function __construct(private string $mode)<\/strong>\r\n<strong>    {}<\/strong>\r\n\r\n<strong>    public function validate(string $attribute, mixed $value, Closure $fail): void<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $valid_modes = ['latitude', 'longitude'];<\/strong>\r\n\r\n<strong>        if(! in_array($this-&gt;mode, $valid_modes, true)) {<\/strong>\r\n\r\n<strong>            throw new \\Exception('$mode \u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093');<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        $patterns = [<\/strong>\r\n<strong>            'latitude' =&gt; '\/^-?([1-8]?[1-9]|[1-9]0)(\\.{1}\\d{1,6})?\/',<\/strong>\r\n<strong>            'longitude' =&gt; '\/^-?([1]?[1-7][1-9]|[1]?[1-8][0]|[1-9]?[0-9])(\\.{1}\\d{1,6})?\/',<\/strong>\r\n<strong>        ];<\/strong>\r\n\r\n<strong>        if($this-&gt;mode === 'latitude' &amp;&amp; preg_match($patterns['latitude'], $value)) {<\/strong>\r\n\r\n<strong>            return; \/\/ \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u901a\u904e<\/strong>\r\n\r\n<strong>        } elseif($this-&gt;mode === 'longitude' &amp;&amp; preg_match($patterns['longitude'], $value)) {<\/strong>\r\n\r\n<strong>            return; \/\/ \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u901a\u904e<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        $fail('\u7def\u5ea6\u307e\u305f\u306f\u7d4c\u5ea6\u306e\u5f62\u5f0f\u304c\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093'); \/\/ \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u3061\u306a\u307f\u306b\u6b63\u898f\u8868\u73fe\u304c\u6b63\u3057\u304f\u52d5\u304f\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u306b\u306f\u3001<strong><a href=\"https:\/\/regex101.com\/\" target=\"_blank\" rel=\"noopener\">regex101<\/a><\/strong> \u304c\u4fbf\u5229\u3067\u3059\u3002\u30ed\u30b0\u30a4\u30f3\u306a\u3057\u3067\u4f7f\u3048\u307e\u3059\u3088\ud83d\udc4d<\/p>\n<\/div>\n<h1>API \u30ea\u30bd\u30fc\u30b9\u3092\u3064\u304f\u308b<\/h1>\n<p>\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u300c<strong>API \u30ea\u30bd\u30fc\u30b9<\/strong>\u300d\u3092\u4f5c\u3063\u3066\u300c<strong>\u5916\u306b\u51fa\u308b\u30c7\u30fc\u30bf\u3092\u53d6\u6368\u9078\u629e<\/strong>\u300d\u3082\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u8ab0\u3067\u3082\u95b2\u89a7\u304c\u3067\u304d\u308b\u30da\u30fc\u30b8\u3067\u4f4f\u6240\u3084\u96fb\u8a71\u756a\u53f7\u306e\u3088\u3046\u306a\u300c\u91cd\u8981\u306a\u30c7\u30fc\u30bf\u300d\u304c\u542b\u307e\u308c\u3066\u3044\u305f\u3089\u56f0\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>\u305d\u3093\u306a\u3068\u304d\u300c<strong>API \u30ea\u30bd\u30fc\u30b9<\/strong>\u300d\u3092\u4f7f\u3048\u3070\u300c<strong>\u3053\u308c\u3068\u3053\u308c\u3001\u3042\u3068\u306f\u3053\u3053\u306e\u30c7\u30fc\u30bf\u3060\u3051 OK<\/strong>\u300d\u306e\u3088\u3046\u306b\u30c7\u30fc\u30bf\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>\uff08\u5143\u30c7\u30fc\u30bf\uff09<\/strong><\/p>\n<div>\n<pre>[\r\n    <strong>'name' =&gt; '\u5c71\u7530\u592a\u90ce',<\/strong>\r\n<strong>    'address' =&gt; '\u6771\u4eac\u90fd\u25cf\u25cf\u533a\u25cf\u25cf...',<\/strong>\r\n<strong>    'tel' =&gt; '090-1234-5678',<\/strong>\r\n]<\/pre>\n<p><strong>\uff08API \u30ea\u30bd\u30fc\u30b9\u306b\u3088\u308b\u30d5\u30a3\u30eb\u30bf\u30fc\u5f8c\uff09<\/strong><\/p>\n<div>\n<pre>[\r\n    <strong>'name' =&gt; '\u5c71\u7530\u592a\u90ce',<\/strong>\r\n]<\/pre>\n<\/div>\n<\/div>\n<p>\u3067\u306f\u5c11\u3057\u8aac\u660e\u304c\u9577\u304f\u306a\u308a\u307e\u3057\u305f\u304c\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:resource UserLocationResource<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>app\/Http\/Resources<\/code>\u30d5\u30a9\u30eb\u30c0\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<\/div>\n<p><strong>app\/Http\/Resources\/UserLocationResource.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Http\\Resources;<\/strong>\r\n\r\n<strong>use Illuminate\\Http\\Request;<\/strong>\r\n<strong>use Illuminate\\Http\\Resources\\Json\\JsonResource;<\/strong>\r\n\r\n<strong>class UserLocationResource extends JsonResource<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    \/**<\/strong>\r\n<strong>     * Transform the resource into an array.<\/strong>\r\n<strong>     *<\/strong>\r\n<strong>     * @return array&lt;string, mixed&gt;<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    public function toArray(Request $request): array<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return [<\/strong>\r\n<strong>            'id' =&gt; $this-&gt;id,<\/strong>\r\n<strong>            'name' =&gt; $this-&gt;name,<\/strong>\r\n<strong>            'latitude' =&gt; $this-&gt;latitude,<\/strong>\r\n<strong>            'longitude' =&gt; $this-&gt;longitude,<\/strong>\r\n<strong>        ];<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<h1>Pusher \u306e\u7528\u30a4\u30d9\u30f3\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3053\u308c\u3082\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u5185\u3067\u4f7f\u3046\u3053\u3068\u306b\u306a\u308b<code>Pusher<\/code>\u7528\u306e\u300c\u30a4\u30d9\u30f3\u30c8\u300d\u3092\u3064\u304f\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:event UserLocationUpdated<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001<code>app\/Events<\/code>\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002\uff08\u592a\u5b57\u90e8\u5206\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\uff09<\/p>\n<p><strong>app\/Events\/UserLocationUpdated.php<\/strong><\/p>\n<div>\n<pre>&lt;?php\r\n\r\nnamespace App\\Events;\r\n\r\nuse Illuminate\\Broadcasting\\Channel;\r\nuse Illuminate\\Broadcasting\\InteractsWithSockets;\r\nuse Illuminate\\Broadcasting\\PresenceChannel;\r\nuse Illuminate\\Broadcasting\\PrivateChannel;\r\nuse Illuminate\\Contracts\\Broadcasting\\ShouldBroadcast;\r\nuse Illuminate\\Foundation\\Events\\Dispatchable;\r\nuse Illuminate\\Queue\\SerializesModels;\r\n\r\nclass UserLocationUpdated<strong> implements ShouldBroadcast<\/strong>\r\n{\r\n    use Dispatchable, InteractsWithSockets, SerializesModels;\r\n\r\n    \/**\r\n     * Create a new event instance.\r\n     *\/\r\n    public function __construct()\r\n    {\r\n        \/\/\r\n    }\r\n\r\n    \/**\r\n     * Get the channels the event should broadcast on.\r\n     *\r\n     * @return array&lt;int, \\Illuminate\\Broadcasting\\Channel&gt;\r\n     *\/\r\n    public function broadcastOn(): array\r\n    {\r\n        <strong>return [<\/strong>\r\n<strong>            new PrivateChannel('user-location-updated'),<\/strong>\r\n<strong>        ];<\/strong>\r\n    }\r\n}<\/pre>\n<\/div>\n<\/div>\n<h1>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u6b21\u306f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308a\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<div>\n<pre><strong>php artisan make:controller UserLocationController<\/strong><\/pre>\n<\/div>\n<p>\u3059\u308b\u3068\u3001<code>app\/Http\/Controllers<\/code>\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/UserLocationController.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Http\\Controllers;<\/strong>\r\n\r\n<strong>use App\\Events\\UserLocationUpdated;<\/strong>\r\n<strong>use App\\Http\\Resources\\UserLocationResource;<\/strong>\r\n<strong>use App\\Models\\UserLocation;<\/strong>\r\n<strong>use App\\Rules\\Location;<\/strong>\r\n<strong>use Illuminate\\Http\\Request;<\/strong>\r\n<strong>use Pusher\\Pusher;<\/strong>\r\n\r\n<strong>class UserLocationController extends Controller<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    public function index()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return view('user_location.index');<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function list()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $minutes = 10; \/\/ \u672c\u6765\u306f config \u306a\u3069\u306b\u5165\u308c\u3066\u304a\u304f\u3079\u304d\u3067\u3059<\/strong>\r\n<strong>        $base_dt = now()-&gt;subMinutes($minutes);<\/strong>\r\n<strong>        $user_locations = UserLocation::query()<\/strong>\r\n<strong>            -&gt;where('updated_at', '&gt;=', $base_dt) \/\/ 5\u5206\u4ee5\u5185\u306b\u66f4\u65b0\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3060\u3051\u53d6\u5f97<\/strong>\r\n<strong>            -&gt;get();<\/strong>\r\n\r\n<strong>        UserLocationResource::withoutWrapping(); \/\/ \u521d\u671f\u72b6\u614b\u3067\u306f\u3001data \u3068\u3044\u3046\u30ad\u30fc\u3067\u30c7\u30fc\u30bf\u304c\u8fd4\u3063\u3066\u304d\u307e\u3059\u304c\u3001\u3081\u3093\u3069\u3046\u306a\u306e\u3067\u6d88\u3057\u307e\u3059<\/strong>\r\n\r\n<strong>        return UserLocationResource::collection($user_locations);<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function create(Request $request)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $validated_data = $request-&gt;validate([<\/strong>\r\n<strong>            'uuid' =&gt; 'required|uuid',<\/strong>\r\n<strong>            'name' =&gt; 'nullable|string|max:255',<\/strong>\r\n<strong>            'latitude' =&gt; new Location('latitude'),<\/strong>\r\n<strong>            'longitude' =&gt; new Location('longitude'),<\/strong>\r\n<strong>        ]);<\/strong>\r\n\r\n<strong>        $uuid = $validated_data['uuid'];<\/strong>\r\n<strong>        $user_location = UserLocation::firstOrCreate(<\/strong>\r\n<strong>            ['uuid' =&gt; $uuid], \/\/ UUID \u304c\u4e00\u81f4\u3059\u308b\u30c7\u30fc\u30bf\u3092\u63a2\u3059<\/strong>\r\n<strong>            $validated_data    \/\/ \u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u3089\u3001\u4f5c\u6210<\/strong>\r\n<strong>        );<\/strong>\r\n<strong>        $result = $user_location-&gt;update($validated_data);<\/strong>\r\n\r\n<strong>        UserLocationUpdated::dispatch();<\/strong>\r\n\r\n<strong>        return ['result' =&gt; $result];<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function auth() \/\/ Pusher \u306b\u8a8d\u8a3c\u3059\u308b\u305f\u3081\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $pusher = new Pusher(<\/strong>\r\n<strong>            config('broadcasting.connections.pusher.key'),<\/strong>\r\n<strong>            config('broadcasting.connections.pusher.secret'),<\/strong>\r\n<strong>            config('broadcasting.connections.pusher.app_id'),<\/strong>\r\n<strong>        );<\/strong>\r\n<strong>        $request = request();<\/strong>\r\n<strong>        $channel_name = $request-&gt;channel_name;<\/strong>\r\n<strong>        $socket_id = $request-&gt;socket_id;<\/strong>\r\n\r\n<strong>        return $pusher-&gt;authorizeChannel($channel_name, $socket_id);<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<h1>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u3001\u5148\u307b\u3069\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u4e2d\u3067\u30bb\u30c3\u30c8\u3057\u305f\u300c<strong>\u30d3\u30e5\u30fc<\/strong>\u300d\u3092\u3064\u304f\u308a\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002\uff08\u30b3\u30de\u30f3\u30c9\u3067\u30d3\u30e5\u30fc\u304c\u4f5c\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u4fbf\u5229\u3067\u3059\u306d \ud83d\udc4d\uff09<\/p>\n<div>\n<pre><strong>php artisan make:view user_location.index<\/strong><\/pre>\n<\/div>\n<p>\u3059\u308b\u3068\u3001<code>resources\/views\/user_location<\/code>\u306b\u30d3\u30e5\u30fc\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>resources\/views\/user_location\/index.blade.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;!DOCTYPE html&gt;<\/strong>\r\n<strong>&lt;html lang=\"ja\"&gt;<\/strong>\r\n<strong>&lt;head&gt;<\/strong>\r\n<strong>    &lt;meta charset=\"UTF-8\"&gt;<\/strong>\r\n<strong>    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;<\/strong>\r\n<strong>    &lt;title&gt;\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u4f4d\u7f6e\u60c5\u5831\u306e\u5171\u6709\u30b7\u30b9\u30c6\u30e0&lt;\/title&gt;<\/strong>\r\n<strong>    @vite(['resources\/css\/app.css', 'resources\/js\/app.js'])<\/strong>\r\n<strong>&lt;\/head&gt;<\/strong>\r\n<strong>&lt;body&gt;<\/strong>\r\n<strong>&lt;div class=\"flex flex-col\" x-data=\"userLocation\"&gt;<\/strong>\r\n<strong>    &lt;!-- \u5730\u56f3\u306e\u30bb\u30af\u30b7\u30e7\u30f3 --&gt;<\/strong>\r\n<strong>    &lt;div class=\"flex-grow bg-gray-200\"&gt;<\/strong>\r\n<strong>        &lt;div class=\"p-4 text-center\"&gt;<\/strong>\r\n<strong>            &lt;div id=\"map\" style=\"height:350px;\"&gt;&lt;\/div&gt; &lt;!-- \u30b5\u30a4\u30ba\u8abf\u6574 --&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>    &lt;\/div&gt;<\/strong>\r\n\r\n<strong>    &lt;!-- \u5165\u529b\u30d5\u30a9\u30fc\u30e0\u3068\u30dc\u30bf\u30f3\u306e\u30bb\u30af\u30b7\u30e7\u30f3 --&gt;<\/strong>\r\n<strong>    &lt;div class=\"bg-white p-4\"&gt;<\/strong>\r\n<strong>        &lt;div class=\"mb-4\"&gt;<\/strong>\r\n<strong>            &lt;label for=\"name\" class=\"block text-gray-700 text-sm font-bold mb-2\"&gt;\u540d\u524d\uff1a&lt;\/label&gt;<\/strong>\r\n<strong>            &lt;input<\/strong>\r\n<strong>                type=\"text\"<\/strong>\r\n<strong>                class=\"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline\"<\/strong>\r\n<strong>                placeholder=\"\u540d\u524d\u3092\u5165\u529b\"<\/strong>\r\n<strong>                x-model=\"params.name\"&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>        &lt;div class=\"mb-4\"&gt;<\/strong>\r\n<strong>            &lt;template x-if=\"isSharingLocation\"&gt;<\/strong>\r\n<strong>                &lt;button<\/strong>\r\n<strong>                    class=\"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline\"<\/strong>\r\n<strong>                    type=\"button\"<\/strong>\r\n<strong>                    @click=\"onStop\"&gt;<\/strong>\r\n<strong>                    \u4f4d\u7f6e\u60c5\u5831\u3092\u5171\u6709\u505c\u6b62<\/strong>\r\n<strong>                &lt;\/button&gt;<\/strong>\r\n<strong>            &lt;\/template&gt;<\/strong>\r\n<strong>            &lt;template x-if=\"! isSharingLocation\"&gt;<\/strong>\r\n<strong>                &lt;button<\/strong>\r\n<strong>                    class=\"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline\"<\/strong>\r\n<strong>                    type=\"button\"<\/strong>\r\n<strong>                    @click=\"onStart\"&gt;<\/strong>\r\n<strong>                    \u4f4d\u7f6e\u60c5\u5831\u3092\u5171\u6709\u3059\u308b<\/strong>\r\n<strong>                &lt;\/button&gt;<\/strong>\r\n<strong>            &lt;\/template&gt;<\/strong>\r\n<strong>        &lt;\/div&gt;<\/strong>\r\n<strong>    &lt;\/div&gt;<\/strong>\r\n\r\n<strong>    &lt;!-- \u30e6\u30fc\u30b6\u30fc\u30ea\u30b9\u30c8\u306e\u30bb\u30af\u30b7\u30e7\u30f3 --&gt;<\/strong>\r\n<strong>    &lt;div class=\"bg-white p-4\"&gt;<\/strong>\r\n<strong>        &lt;h2 class=\"text-xl font-semibold mb-2 text-gray-800\"&gt;\u30e6\u30fc\u30b6\u30fc\u30ea\u30b9\u30c8&lt;\/h2&gt;<\/strong>\r\n<strong>        &lt;template x-if=\"userLocations.length === 0\"&gt;<\/strong>\r\n<strong>            &lt;p&gt;\u30e6\u30fc\u30b6\u30fc\u306f\u3044\u307e\u305b\u3093&lt;\/p&gt;<\/strong>\r\n<strong>        &lt;\/template&gt;<\/strong>\r\n<strong>        &lt;template x-if=\"userLocations.length &gt; 0\"&gt;<\/strong>\r\n<strong>            &lt;ul&gt;<\/strong>\r\n<strong>                &lt;template x-for=\"(userLocation) in userLocations\" :key=\"userLocation.id\"&gt;<\/strong>\r\n<strong>                    &lt;li class=\"mb-2 p-2 border-b border-gray-200 hover:bg-gray-100 flex justify-between items-center\"&gt;<\/strong>\r\n<strong>                        &lt;span x-text=\"userLocation.name\"&gt;&lt;\/span&gt;<\/strong>\r\n<strong>                        &lt;!-- \u300c\u73fe\u5728\u5730\u3078\u300d\u30dc\u30bf\u30f3 --&gt;<\/strong>\r\n<strong>                        &lt;button<\/strong>\r\n<strong>                            class=\"bg-blue-500 hover:bg-blue-700 text-white font-bold py-1 px-2 rounded text-xs focus:outline-none focus:shadow-outline\"<\/strong>\r\n<strong>                            @click=\"onCurrentLocationClick(userLocation)\"&gt;<\/strong>\r\n<strong>                            \u73fe\u5728\u5730\u3078<\/strong>\r\n<strong>                        &lt;\/button&gt;<\/strong>\r\n<strong>                    &lt;\/li&gt;<\/strong>\r\n<strong>                &lt;\/template&gt;<\/strong>\r\n<strong>            &lt;\/ul&gt;<\/strong>\r\n<strong>        &lt;\/template&gt;<\/strong>\r\n<strong>    &lt;\/div&gt;<\/strong>\r\n<strong>&lt;\/div&gt;<\/strong>\r\n<strong>&lt;script&gt;<\/strong>\r\n\r\n<strong>    const userLocation = () =&gt; {<\/strong>\r\n\r\n<strong>        \/\/ Alpine.js \u306e\u4e2d\u3067\u4f7f\u3046\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b\u5834\u5408\u304c\u3042\u308b\u306e\u3067\u3001\u5916\u3067\u5b9a\u7fa9\u3059\u308b<\/strong>\r\n<strong>        let map = null;<\/strong>\r\n<strong>        let mapMarkers = [];<\/strong>\r\n\r\n<strong>        return {<\/strong>\r\n\r\n<strong>            \/\/ Data<\/strong>\r\n<strong>            params: {<\/strong>\r\n<strong>                uuid: '',<\/strong>\r\n<strong>                name: '',<\/strong>\r\n<strong>                latitude: '',<\/strong>\r\n<strong>                longitude: '',<\/strong>\r\n<strong>            },<\/strong>\r\n<strong>            userLocations: [],<\/strong>\r\n<strong>            isSharingLocation: false,<\/strong>\r\n<strong>            isInitialized: false,<\/strong>\r\n<strong>            locationWatchId: null,<\/strong>\r\n\r\n<strong>            \/\/ Methods<\/strong>\r\n<strong>            init() {<\/strong>\r\n\r\n<strong>                if(this.isInitialized === false) {<\/strong>\r\n\r\n<strong>                    this.initialized = true;<\/strong>\r\n<strong>                    this.initBroadcast();<\/strong>\r\n<strong>                    this.initUuid();<\/strong>\r\n<strong>                    this.initMap();<\/strong>\r\n<strong>                    this.getUserLocations();<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            initBroadcast() {<\/strong>\r\n\r\n<strong>                Echo.private('user-location-updated')<\/strong>\r\n<strong>                    .listen('UserLocationUpdated', () =&gt; {<\/strong>\r\n\r\n<strong>                        this.getUserLocations();<\/strong>\r\n\r\n<strong>                    });<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            initUuid() {<\/strong>\r\n\r\n<strong>                let uuid = localStorage.getItem('uuid');<\/strong>\r\n\r\n<strong>                if(! uuid) { \/\/ uuid \u304c\u306a\u3044\u3068\u304d<\/strong>\r\n\r\n<strong>                    uuid = self.crypto.randomUUID();<\/strong>\r\n<strong>                    localStorage.setItem('uuid', uuid);<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>                this.params.uuid = uuid;<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            initMap() {<\/strong>\r\n\r\n<strong>                map = L.map('map').setView([35.680545109582106, 139.76822649218585], 13);<\/strong>\r\n<strong>                L.Marker.prototype.setIcon(L.icon({<\/strong>\r\n<strong>                    iconUrl: markerIcon,<\/strong>\r\n<strong>                    iconSize: [25, 41],<\/strong>\r\n<strong>                }));<\/strong>\r\n\r\n<strong>                L.tileLayer('https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png', {<\/strong>\r\n<strong>                    maxZoom: 19,<\/strong>\r\n<strong>                    attribution: '&amp;copy; &lt;a href=\"http:\/\/www.openstreetmap.org\/copyright\"&gt;OpenStreetMap&lt;\/a&gt;'<\/strong>\r\n<strong>                }).addTo(map);<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            getUserLocations() {<\/strong>\r\n\r\n<strong>                const url = '\/user_location\/list';<\/strong>\r\n<strong>                axios.get(url)<\/strong>\r\n<strong>                    .then((response) =&gt; {<\/strong>\r\n\r\n<strong>                        this.userLocations = response.data;<\/strong>\r\n<strong>                        mapMarkers.forEach((marker) =&gt; marker.remove()); \/\/ \u30de\u30fc\u30ab\u30fc\u3092\u5168\u524a\u9664<\/strong>\r\n<strong>                        mapMarkers = [];<\/strong>\r\n\r\n<strong>                        let bounds = [];<\/strong>\r\n\r\n<strong>                        this.userLocations.forEach((userLocation) =&gt; {<\/strong>\r\n\r\n<strong>                            const latitude = userLocation.latitude;<\/strong>\r\n<strong>                            const longitude = userLocation.longitude;<\/strong>\r\n<strong>                            const mapMarker = L.marker([latitude, longitude])<\/strong>\r\n<strong>                                .addTo(map)<\/strong>\r\n<strong>                                .bindPopup(userLocation.name, { closeButton: false, autoClose: false }) \/\/ \u5e38\u306b\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u3092\u8868\u793a<\/strong>\r\n<strong>                                .openPopup();<\/strong>\r\n<strong>                            mapMarkers.push(mapMarker);<\/strong>\r\n\r\n<strong>                            bounds.push([latitude, longitude]);<\/strong>\r\n\r\n<strong>                        });<\/strong>\r\n\r\n<strong>                        map.fitBounds(bounds); \/\/ \u30de\u30fc\u30ab\u30fc\u304c\u5168\u3066\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u5730\u56f3\u306e\u8868\u793a\u3092\u81ea\u52d5\u3067\u5909\u66f4<\/strong>\r\n\r\n<strong>                    });<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onWatchPositionSuccess(position) {<\/strong>\r\n\r\n<strong>                this.params.latitude = position.coords.latitude;<\/strong>\r\n<strong>                this.params.longitude = position.coords.longitude;<\/strong>\r\n<strong>                this.isSharingLocation = true;<\/strong>\r\n\r\n<strong>                const url = '\/user_location';<\/strong>\r\n<strong>                axios.post(url, this.params); \/\/ \u73fe\u5728\u306e\u4f4d\u7f6e\u60c5\u5831\u3092\u4fdd\u5b58<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onWatchPositionError(error) {<\/strong>\r\n\r\n<strong>                this.isSharingLocation = false;<\/strong>\r\n<strong>                console.log('\u4f4d\u7f6e\u60c5\u5831\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f', error);<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onStart() {<\/strong>\r\n\r\n<strong>                if(! this.params.name) {<\/strong>\r\n\r\n<strong>                    alert('\u540d\u524d\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044');<\/strong>\r\n<strong>                    return;<\/strong>\r\n\r\n<strong>                } else if(confirm('\u4f4d\u7f6e\u60c5\u5831\u3092\u5171\u6709\u3057\u307e\u3059\u304b\uff1f') === true) {<\/strong>\r\n\r\n<strong>                    const options = {<\/strong>\r\n<strong>                        enableHighAccuracy: true, \/\/ \u3088\u308a\u7cbe\u5ea6\u306e\u9ad8\u3044\u4f4d\u7f6e\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b<\/strong>\r\n<strong>                        timeout: 30000,<\/strong>\r\n<strong>                        maximumAge: 0,<\/strong>\r\n<strong>                    };<\/strong>\r\n<strong>                    this.locationWatchId = navigator.geolocation.watchPosition(<\/strong>\r\n<strong>                        (position) =&gt; this.onWatchPositionSuccess(position), \/\/ \u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u5148\u3067 this \u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/strong>\r\n<strong>                        (error) =&gt; this.onWatchPositionError(error), \/\/ \u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u5148\u3067 this \u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/strong>\r\n<strong>                        options<\/strong>\r\n<strong>                    );<\/strong>\r\n\r\n<strong>                }<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onStop() {<\/strong>\r\n\r\n<strong>                navigator.geolocation.clearWatch(this.locationWatchId);<\/strong>\r\n<strong>                this.isSharingLocation = false;<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>            onCurrentLocationClick(userLocation) {<\/strong>\r\n\r\n<strong>                map.setView([userLocation.latitude, userLocation.longitude], 20);<\/strong>\r\n\r\n<strong>            },<\/strong>\r\n<strong>        };<\/strong>\r\n\r\n<strong>    };<\/strong>\r\n\r\n<strong>&lt;\/script&gt;<\/strong>\r\n<strong>&lt;\/body&gt;<\/strong>\r\n<strong>&lt;\/html&gt;<\/strong><\/pre>\n<\/div>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<div>\n<pre>use App\\Http\\Controllers\\UserLocationController;\r\n\r\n\/\/ \u7701\u7565\r\n\r\n<strong>Route::get('user_location', [UserLocationController::class, 'index'])-&gt;name('user_location.index');<\/strong><\/pre>\n<\/div>\n<p>\u3053\u308c\u3067\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\u3002\ud83d\ude04\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<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u4eca\u56de\u306f\u4f4d\u7f6e\u60c5\u5831\u3092\u81ea\u7531\u306b\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\n\u307e\u305a\u3001<code>Google Chrome<\/code>\u306e\u958b\u767a\u30c4\u30fc\u30eb\uff08<code>devTool<\/code>\uff09\u3092\u958b\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u53f3\u4e0a\u306e\u300c<strong>\u4e09\u70b9\u30b3\u30fc\u30c0 \uff1e More tools \uff1e Sensors<\/strong>\u300d\u3092\u9078\u629e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12205\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_2.png\" alt=\"\" width=\"416\" height=\"650\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_2.png 416w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_2-192x300.png 192w\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u958b\u767a\u30c4\u30fc\u30eb\u306e\u4e0b\u5074\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u4f4d\u7f6e\u60c5\u5831\u3092\u81ea\u7531\u306b\u5909\u66f4\u3067\u304d\u308b\u30c4\u30fc\u30eb\u304c\u51fa\u3066\u304d\u307e\u3059\u306e\u3067\u3001\u3053\u308c\u3092\u4f7f\u3063\u3066\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12204\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_3.png\" alt=\"\" width=\"391\" height=\"199\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_3.png 391w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_3-300x153.png 300w\" sizes=\"auto, (max-width: 391px) 100vw, 391px\" \/><\/p>\n<p>\u3067\u306f\u3001\u307e\u305a\u306f\u30d6\u30e9\u30a6\u30b6\u3067\u300c<strong>https:\/\/******\/user_location<\/strong>\u300d\u3078\u30a2\u30af\u30bb\u30b9\u3057\u540d\u524d\u3092\u5165\u529b\u3057\u3066\u300c<strong>\u4f4d\u7f6e\u60c5\u5831\u3092\u5171\u6709\u3059\u308b<\/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-12206\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_4.png\" alt=\"\" width=\"543\" height=\"800\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u300c<strong>\u4f4d\u7f6e\u60c5\u5831\u3092\u5171\u6709\u3057\u307e\u3059\u304b\uff1f<\/strong>\u300d\u3068\u78ba\u8a8d\u304c\u3067\u308b\u306e\u3067\u3001\u3053\u308c\u3092<code>OK<\/code>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12208\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_5.png\" alt=\"\" width=\"543\" height=\"380\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_5.png 543w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_5-300x210.png 300w\" sizes=\"auto, (max-width: 543px) 100vw, 543px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u81ea\u52d5\u7684\u306b\u5730\u56f3\u304c\u66f4\u65b0\u3055\u308c\u3066\u3001\u300c<strong>\u5c71\u7530\u592a\u90ce<\/strong>\u300d\u3055\u3093\u304c\u6771\u4eac\u306b\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u6b21\u306b\u300c<strong>\u4f50\u85e4\u6b21\u90ce<\/strong>\u300d\u3055\u3093\u3067\u540c\u3058\u3053\u3068\u3092\u3057\u307e\u3059\u304c\u3001\u4eca\u5ea6\u306f\u300c\u4e2d\u56fd\u306e\u4e0a\u6d77\u300d\u306b\u3044\u308b\u3053\u3068\u306b\u3057\u3066\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\uff08\u306a\u304a\u3001\u5225\u74b0\u5883\u304c\u5fc5\u8981\u306a\u306e\u3067<code>Chrome<\/code>\u306e\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30d6\u30e9\u30a6\u30b8\u30f3\u30b0\u3092\u4f7f\u3063\u3066\u5b9f\u65bd\u3057\u307e\u3059\uff09<\/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-12209\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_6.png\" alt=\"\" width=\"543\" height=\"380\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_6.png 543w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_6-300x210.png 300w\" sizes=\"auto, (max-width: 543px) 100vw, 543px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u592a\u90ce\u3055\u3093\u304c\u6771\u4eac\u3001\u6b21\u90ce\u3055\u3093\u304c\u4e0a\u6d77\u306b\u3044\u308b\u3053\u3068\u304c\u5206\u304b\u308b\u5730\u56f3\u306b\u5909\u66f4\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u5730\u56f3\u306e\u4e0b\u306b\u3042\u308b\u6b21\u90ce\u3055\u3093\u306e\u300c<strong>\u73fe\u5728\u5730\u3078<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12210\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_7.png\" alt=\"\" width=\"540\" height=\"157\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_7.png 540w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_7-300x87.png 300w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/p>\n<p>\u3069\u3046\u306a\u3063\u305f\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12211\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_8.png\" alt=\"\" width=\"543\" height=\"380\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_8.png 543w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/11\/laravel_user_location_sharing_8-300x210.png 300w\" sizes=\"auto, (max-width: 543px) 100vw, 543px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u6b21\u90ce\u3055\u3093\u306e\u3044\u308b\u5834\u6240\u306b\u5730\u56f3\u304c\u79fb\u52d5\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u5168\u3066\u6210\u529f\u3067\u3059\ud83d\ude04\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u56de\u306f\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u306f\u8a2d\u3051\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u7279\u5b9a\u30b0\u30eb\u30fc\u30d7\u3060\u3051\u3067\u4f4d\u7f6e\u5171\u6709\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u304c\u3001\u305d\u3046\u3044\u3063\u305f\u6a5f\u80fd\u3092\u3064\u3051\u308b\u3053\u3068\u3067\u300c<strong>\u7dca\u6025\u6642\u306e\u5bb6\u65cf\u3084\u793e\u54e1\u3055\u3093\u306e\u4f4d\u7f6e\u60c5\u5831<\/strong>\u300d\u3092\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u628a\u63e1\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u7dca\u6025\u6642\u3067\u306a\u304f\u3068\u3082\u5de5\u5834\u5185\u3084\u30d3\u30eb\u5185\u3067\u4f4d\u7f6e\u60c5\u5831\u3092\u5171\u6709\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u3084\u3001\uff08\u8cdb\u5426\u3042\u308b\u3068\u306f\u601d\u3044\u307e\u3059\u304c\uff09\u55b6\u696d\u3055\u3093\u306e\u5916\u56de\u308a\u306e\u4f4d\u7f6e\u78ba\u8a8d\u306a\u3069\u306b\u4f7f\u3048\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3082\u3057\u305d\u3046\u3044\u3063\u305f\u6a5f\u80fd\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u3044\u3064\u3067\u3082\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude04\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u300c<strong>Laravel + Pusher<\/strong>\u300d\u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u5909\u5316\u3059\u308b\u4f4d\u7f6e\u60c5\u5831\u5171\u6709\u30b7\u30b9\u30c6\u30e0\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u3061\u3087\u3063\u3068\u82e6\u52b4\u3057\u305f\u306e\u306f\u300c<code>leaflet.js<\/code>\u306e\u305f\u3081\u306e\u5909\u6570\u3092<code>Alpine.js<\/code>\u5185\u306b\u3082\u305f\u305b\u308b\u3068\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u5834\u5408\u304c\u3042\u308b\u300d\u3068\u3044\u3046\u90e8\u5206\u3067\u3057\u305f\u3002<\/p>\n<p>\u3069\u3046\u3084\u3089\u3053\u308c\u306f\u5909\u6570\u304c<code>Proxy<\/code>\u5316\u3055\u308c\u308b\u305f\u3081\u3001\u305d\u308c\u304c\u539f\u56e0\u3068\u306e\u3053\u3068\u3067\u3057\u305f\u3002\u305d\u306e\u305f\u3081\u3001<code>Vue<\/code>\u306a\u3069\u3067\u3082\u540c\u3058\u3053\u3068\u304c\u8d77\u3053\u308b\u3088\u3046\u3067\u3059\u3002\uff08\u5909\u6570\u3092\u6bce\u56de\u901a\u5e38\u306e\u5909\u6570\u306b\u30b3\u30f3\u30d0\u30fc\u30c8\u3057\u3066\u3042\u3052\u308c\u3070<code>OK<\/code>\u306a\u3088\u3046\u3067\u3059\u304c\u3001\u305d\u308c\u3082\u3061\u3087\u3063\u3068\u9762\u5012\u3067\u3059\u3088\u306d\ud83d\ude05\uff09<\/p>\n<p>\u305d\u308c\u306b\u3057\u3066\u3082\u3084\u306f\u308a<code>Pusher<\/code>\u3063\u3066\u4fbf\u5229\u3067\u3059\u306d\u3002<br \/>\n\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u306a\u3093\u3067\u3082\u3067\u304d\u3061\u3083\u3044\u307e\u3059\u306e\u3067\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u4f55\u304b\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u5b9f\u88c5\u3092\u3057\u3066\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-6068 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12.png\" alt=\"\" width=\"226\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12.png 226w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_12-212x300.png 212w\" sizes=\"auto, (max-width: 226px) 100vw, 226px\" \/>\u300c\u5e74\u672b\u306b\u5948\u826f\u3067\u98df\u3079\u308b<br \/>\n\u3046\u307e\u3044\u304a\u5bff\u53f8\u304c<br \/>\n\u3068\u3063\u3066\u3082\u697d\u3057\u307f\u2757\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u3053\u308c\u306f\u500b\u4eba\u7684\u306b\u306f\u300c\u3048\u3001\u305d\u3053\u307e\u3067\u3059\u308b\u3093\u3060\u2026\ud83d\ude05\u300d\u3068\u3044\u3046\u6c17\u6301\u3061\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u3042\u308b\u300c\u30b0\u30eb\u30fc\u30d7\u5185\u3067\u5229\u7528\u3055\u308c\u308b\u3068\u8a00\u308f\u308c\u308b\u300d\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002 \u305d\u308c\u304c\u30fb\u30fb &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=12196\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel + Pusher \u3067\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306a\u4f4d\u7f6e\u60c5\u5831\u306e\u5171\u6709\u30b7\u30b9\u30c6\u30e0\u3092\u3064\u304f\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":12213,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[255,3],"tags":[],"class_list":["post-12196","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-alpine-js","category-laravel"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12196","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=12196"}],"version-history":[{"count":5,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12196\/revisions"}],"predecessor-version":[{"id":12215,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/12196\/revisions\/12215"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/12213"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}