{"id":11555,"date":"2023-05-08T07:00:56","date_gmt":"2023-05-07T22:00:56","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=11555"},"modified":"2024-04-18T17:39:45","modified_gmt":"2024-04-18T08:39:45","slug":"laravel%e3%83%a6%e3%83%bc%e3%82%b6%e3%83%bc%e5%bf%85%e8%a6%8b%ef%bc%81%e3%83%a6%e3%83%bc%e3%82%b6%e3%83%bc%e7%99%bb%e9%8c%b2%e3%81%aa%e3%81%97%e3%81%a7%e3%82%a6%e3%82%a7%e3%83%96%e3%83%97%e3%83%83","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=11555","title":{"rendered":"Laravel\u30e6\u30fc\u30b6\u30fc\u5fc5\u898b\uff01\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306a\u3057\u3067\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u3092\u5b9f\u88c5\u3057\u3088\u3046\uff01"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u5148\u65e5\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u306b\u95a2\u3059\u308b\u300c<strong><a class=\"row-title\" href=\"https:\/\/blog.capilano-fw.com\/?p=11536\" target=\"_blank\" rel=\"noopener\" aria-label=\"\u300cLaravel + React\u3067\u5b9f\u73fe\u3059\u308bWeb\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\uff01ChatGPT\u3068\u5171\u306biOS 16.4\u3067\u8a66\u3057\u3066\u307f\u305f\u7d50\u679c\u300d (\u7de8\u96c6)\">Laravel + React\u3067\u5b9f\u73fe\u3059\u308bWeb\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\uff01ChatGPT\u3068\u5171\u306biOS 16.4\u3067\u8a66\u3057\u3066\u307f\u305f\u7d50\u679c<\/a><\/strong>\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>iPhone<\/code>\u3067\u3082\u3061\u3083\u3093\u3068\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u304c\u6a5f\u80fd\u3057\u3066\u3044\u308b\u306e\u3092\u78ba\u8a8d\u3057\u305f\u306e\u3067\u30c6\u30f3\u30b7\u30e7\u30f3\u304c\u4e0a\u304c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u524d\u56de\uff11\u3064\u3060\u3051\u300c<strong>\u3046\u30fc\u3093\u3001\u3082\u3063\u3068\u2026\ud83d\ude05<\/strong>\u300d\u3068\u601d\u3046\u90e8\u5206\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u3066\u306a\u3044\u4eba\u306b\u3082\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u3057\u305f\u3044\u2757<\/strong><\/p>\n<p>\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u524d\u56de\u306f\u767b\u9332\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u3092\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u547c\u3073\u51fa\u3057\u3066\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u3092\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u5b9f\u969b\u306e\u30a6\u30a7\u30d6\u30b5\u30fc\u30d3\u30b9\u904b\u7528\u3092\u8003\u3048\u308b\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306a\u3057\u3067\u3082\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u300c<strong>\u51b7\u3084\u3057\u4e2d\u83ef\u306f\u3058\u3081\u307e\u3057\u305f\uff01<\/strong>\u300d\u3068\u3044\u3063\u305f\u901a\u77e5\u306e\u305f\u3081\u3060\u3051\u306b\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3059\u308b\u306e\u306f\u624b\u9593\u3067\u3059\u3057\u3001\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u305f\u3068\u3057\u3066\u3082\uff08\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u306e\u5834\u5408\u306f\uff09\u7d50\u5c40\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u306e\u8a2d\u5b9a\u3092\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u3067\u30e1\u30f3\u30c9\u30a6\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f\u3001<code>Laravel<\/code>\u3092\u4f7f\u3063\u3066\u300c<strong>\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306a\u3057\u3067\u3082\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u306e\u767b\u9332\uff0f\u89e3\u9664\u3067\u304d\u308b\u6a5f\u80fd<\/strong>\u300d\u3092\u4f5c\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-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u307b\u308d\u9154\u3044\u3067<br \/>\n\u6620\u753b\u300cWinny\u300d\u3092\u898b\u305f\u3089\u3001<br \/>\n\u601d\u308f\u305a\u6ce3\u304d\u305d\u3046\u306b\u306a\u308a\u307e\u3057\u305f\ud83d\ude22<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 10.x\u3001JavaScript\uff08\u30d0\u30cb\u30e9\uff09<\/p>\n<h1><span id=\"i-2\">\u524d\u63d0\u3068\u3057\u3066<\/span><\/h1>\n<p>\u3053\u306e\u8a18\u4e8b\u3092\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001\u30ed\u30fc\u30ab\u30eb\u3067\u5b9f\u884c\u3059\u308b\u969b\u3067\u3082<code>https<\/code>\u304c\u5fc5\u8981\u3067\u3055\u3089\u306b\u81ea\u5df1\u8a3c\u660e\u66f8\u3067\u3082\u30c0\u30e1\u3067\u3059\u3002<\/p>\n<p>\u8a73\u3057\u304f\u306f\u4ee5\u4e0b\u3092\u3054\u89a7\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=5404#i-12\" target=\"_blank\" rel=\"noopener\">\u63a5\u7d9a\u74b0\u5883\u306e\u30a8\u30e9\u30fc\u306b\u3064\u3044\u3066<\/a><\/p>\n<h1>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p>\u3067\u306f\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304f\u524d\u306b\u5fc5\u8981\u306b\u306a\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<div>\n<div>\n<pre><strong>composer require laravel-notification-channels\/webpush<\/strong><\/pre>\n<p>\u3053\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306f\u4ee5\u524d\u306e\u8a18\u4e8b\u3067\u3082\u4f7f\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u4fbf\u5229\u6a5f\u80fd\u3092\u4f7f\u308f\u305b\u3066\u3082\u3089\u3063\u3066\u958b\u767a\u3057\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306a\u3069\u306f\u72ec\u81ea\u306b\u7528\u610f\u3059\u308b\u306e\u3067\u3001<code>vapid<\/code>\u30ad\u30fc\u3092\u3064\u304f\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3060\u3051\u5b9f\u884c\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan webpush:vapid<\/strong><\/pre>\n<p>\u3053\u308c\u306b\u3088\u308a<code>.env<\/code>\u5185\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u304c\u8ffd\u52a0\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div>\n<pre><strong>VAPID_PUBLIC_KEY=\uff08\u3042\u306a\u305f\u306e\u516c\u958b\u9375\uff09<\/strong>\r\n<strong>VAPID_PRIVATE_KEY=\uff08\u3042\u306a\u305f\u306e\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30ad\u30fc\uff09<\/strong><\/pre>\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\u307e\u308f\u308a\u306e\u6e96\u5099\u3092\u3057\u3066\u3044\u304d\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:model AnonymousPushSubscription -m<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\uff12\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Models\/AnonymousPushSubscription.php<\/strong><\/p>\n<\/div>\n<div>\n<pre>&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass AnonymousPushSubscription extends Model\r\n{\r\n    use HasFactory;\r\n\r\n    <strong>protected $guarded = ['id']; \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n}<\/pre>\n<\/div>\n<p>\u305d\u3057\u3066\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_anonymous_push_subscriptions_table.php<\/strong><\/p>\n<div>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up(): void\r\n{\r\n<strong>    Schema::create('anonymous_push_subscriptions', function (Blueprint $table) {<\/strong>\r\n<strong>        $table-&gt;id();<\/strong>\r\n<strong>        $table-&gt;string('key')-&gt;comment('\u4efb\u610f\u306e\u30ad\u30fc');<\/strong>\r\n<strong>        $table-&gt;string('endpoint')-&gt;comment('\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8');<\/strong>\r\n<strong>        $table-&gt;string('public_key')-&gt;comment('\u516c\u958b\u9375');<\/strong>\r\n<strong>        $table-&gt;string('auth_token')-&gt;comment('\u8a8d\u8a3c\u30c8\u30fc\u30af\u30f3');<\/strong>\r\n<strong>        $table-&gt;string('content_encoding')-&gt;comment('\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u5f62\u5f0f');<\/strong>\r\n<strong>        $table-&gt;timestamps();<\/strong>\r\n<strong>    });<\/strong>\r\n}\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<\/div>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30c6\u30fc\u30d6\u30eb\u3092\u8ffd\u52a0\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<p>\u3059\u308b\u3068\u3001\u5b9f\u969b\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11557\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/04\/laravel_anonymous_web_push_1.png\" alt=\"\" width=\"478\" height=\"328\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/04\/laravel_anonymous_web_push_1.png 478w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/04\/laravel_anonymous_web_push_1-300x206.png 300w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/p>\n<h1>\u72ec\u81ea\u306e Notification \u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u3001<code>Notification<\/code>\u3067\u4f7f\u3046\u305f\u3081\u306e\u300c<strong>\u30c1\u30e3\u30f3\u30cd\u30eb<\/strong>\u300d\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p>\u30c1\u30e3\u30f3\u30cd\u30eb\u306f\u3001\u4f8b\u3048\u3070\u3001<\/p>\n<ul>\n<li>\u30e1\u30fc\u30eb<\/li>\n<li>slack<\/li>\n<li>LINE<\/li>\n<\/ul>\n<p>\u306a\u3069\u300c<strong>\u3069\u3093\u306a\u7d4c\u8def\u3067\u901a\u77e5\u3059\u308b\u306e\uff1f<\/strong>\u300d\u3092\u8a2d\u5b9a\u3059\u308b\u3082\u306e\u3060\u3068\u8003\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u305d\u3057\u3066\u4eca\u56de\u306f\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306a\u3057\u306e\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u306a\u306e\u3067\u3001\u300c<strong>AnonymousPushChannel<\/strong>\u300d\u3068\u3044\u3046\u540d\u524d\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e2d\u8eab\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>app\/Notifications\/AnonymousPushChannel.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Notifications;<\/strong>\r\n\r\n<strong>use Illuminate\\Notifications\\Notification;<\/strong>\r\n<strong>use Minishlink\\WebPush\\Subscription;<\/strong>\r\n<strong>use Minishlink\\WebPush\\WebPush;<\/strong>\r\n<strong>use NotificationChannels\\WebPush\\ReportHandler;<\/strong>\r\n\r\n<strong>class AnonymousPushChannel<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    public function __construct(ReportHandler $reportHandler)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $auth = [<\/strong>\r\n<strong>            'VAPID' =&gt; [<\/strong>\r\n<strong>                'subject' =&gt; url('\/'),<\/strong>\r\n<strong>                'publicKey' =&gt; env('VAPID_PUBLIC_KEY'), \/\/ \u672c\u6765\u306f\u30b3\u30f3\u30d5\u30a3\u30b0\u306b\u767b\u9332\u3059\u3079\u304d\u3067\u3059<\/strong>\r\n<strong>                'privateKey' =&gt; env('VAPID_PRIVATE_KEY'), \/\/ \u672c\u6765\u306f\u30b3\u30f3\u30d5\u30a3\u30b0\u306b\u767b\u9332\u3059\u3079\u304d\u3067\u3059<\/strong>\r\n<strong>            ],<\/strong>\r\n<strong>        ];<\/strong>\r\n\r\n<strong>        $this-&gt;webPush = new WebPush($auth);<\/strong>\r\n<strong>        $this-&gt;reportHandler = $reportHandler;<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function send($notifiable, Notification $notification)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $message = $notification-&gt;toAnonymousPush();<\/strong>\r\n<strong>        $payload = json_encode($message-&gt;toArray());<\/strong>\r\n<strong>        $subscriptions = $notification-&gt;getSubscriptions();<\/strong>\r\n\r\n<strong>        if($subscriptions-&gt;isEmpty()) { \/\/ \u9001\u4fe1\u3059\u308b\u3082\u306e\u304c\u306a\u3044\u3068\u304d\u306f\u7d42\u4e86<\/strong>\r\n\r\n<strong>            return;<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        foreach ($subscriptions as $subscription) { \/\/ \u3072\u3068\u3064\u305a\u3064\u9001\u4fe1\u3059\u308b<\/strong>\r\n\r\n<strong>            $web_push_subscription = new Subscription(<\/strong>\r\n<strong>                $subscription-&gt;endpoint,<\/strong>\r\n<strong>                $subscription-&gt;public_key,<\/strong>\r\n<strong>                $subscription-&gt;auth_token,<\/strong>\r\n<strong>                null,<\/strong>\r\n<strong>            );<\/strong>\r\n<strong>            $this-&gt;webPush-&gt;queueNotification($web_push_subscription, $payload);<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        $reports = $this-&gt;webPush-&gt;flush();<\/strong>\r\n\r\n<strong>        foreach ($reports as $report) {<\/strong>\r\n\r\n<strong>            if ($report) {<\/strong>\r\n\r\n<strong>                $this-&gt;reportHandler-&gt;handleReport($report, $subscription, $message);<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u306f\u3001\u6700\u521d\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u3092\u9001\u4fe1\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u672c\u5bb6\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u306f<code>ServiceProvider<\/code>\u306e\u4e2d\u3067\u8a8d\u8a3c\u60c5\u5831\u3092\u8ffd\u52a0\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u307b\u307c\u540c\u3058\u5185\u5bb9\u3092\u72ec\u81ea\u306e\u3082\u306e\u3092\u3064\u304f\u308b\u306e\u3082\u3081\u3093\u3069\u3046\u306a\u306e\u3067\u3001\u76f4\u63a5\u8a8d\u8a3c\u60c5\u5831\u3092\u8ffd\u52a0\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002\uff08\u304a\u597d\u307f\u3067\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<\/div>\n<h1>\u72ec\u81ea\u306e Notification \u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u540d\u524d\u306a\u3057\u3067\u5b9f\u884c\u3059\u308b\u305f\u3081\u306e\u5c02\u7528<code>Notification<\/code>\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:notification AnonymousPushNotification<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Notifications\/AnonymousPushNotification.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Notifications;<\/strong>\r\n\r\n<strong>use App\\Models\\AnonymousPushSubscription;<\/strong>\r\n<strong>use Illuminate\\Notifications\\Notification;<\/strong>\r\n<strong>use NotificationChannels\\WebPush\\WebPushMessage;<\/strong>\r\n\r\n<strong>class AnonymousPushNotification extends Notification<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    public function __construct(string $subscription_key, WebPushMessage $message)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $this-&gt;subscriptions = AnonymousPushSubscription::where('key', $subscription_key)-&gt;get();<\/strong>\r\n<strong>        $this-&gt;message = $message;<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function via(): array<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return [AnonymousPushChannel::class];<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function toAnonymousPush()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return $this-&gt;message;<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function getSubscriptions()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return $this-&gt;subscriptions;<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u3053\u306e\u30af\u30e9\u30b9\u306e\u30e1\u30a4\u30f3\u306e\u76ee\u7684\u306f\u3001\u5148\u307b\u3069\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u304b\u3089\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001<code>toAnonymousPush()<\/code>\u304c\u30e1\u30c3\u30bb\u30fc\u30b8\uff08\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u306e\u30bf\u30a4\u30c8\u30eb\u3084\u672c\u6587\uff09\u3001\u305d\u3057\u3066<code>getSubscriptions()<\/code>\u306f<code>anonymous_push_subscriptions<\/code>\u30c6\u30fc\u30d6\u30eb\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u306e\u5b9b\u5148\u306a\u3069\u3067\u3059\u3002<\/p>\n<\/div>\n<\/div>\n<h1>\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u306e\u767b\u9332\u30fb\u89e3\u9664\u30da\u30fc\u30b8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3053\u3053\u304b\u3089\u306f\u8a2a\u554f\u30e6\u30fc\u30b6\u30fc\u304c\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u90e8\u5206\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h2>\n<p>\u307e\u305a\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\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:controller AnonymousPushController<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/AnonymousPushController.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\\Models\\AnonymousPushSubscription;<\/strong>\r\n<strong>use App\\Notifications\\AnonymousPushNotification;<\/strong>\r\n<strong>use Illuminate\\Http\\Request;<\/strong>\r\n<strong>use Illuminate\\Support\\Facades\\Notification;<\/strong>\r\n<strong>use NotificationChannels\\WebPush\\WebPushMessage;<\/strong>\r\n\r\n<strong>class AnonymousPushController extends Controller<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    public function index()<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        return view('anonymous_push.index');<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function store(Request $request)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        \/\/ \u6ce8\u610f\uff1a \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306f\u7701\u7565\u3057\u3066\u307e\u3059<\/strong>\r\n\r\n<strong>        $endpoint = $request-&gt;input('subscription.endpoint');<\/strong>\r\n<strong>        $public_key = $request-&gt;input('subscription.keys.p256dh');<\/strong>\r\n<strong>        $auth_token = $request-&gt;input('subscription.keys.auth');<\/strong>\r\n<strong>        $subscription_key = 'new_item_added'; \/\/ \u65b0\u5546\u54c1\u5165\u8377<\/strong>\r\n\r\n<strong>        $subscription = AnonymousPushSubscription::firstOrNew([<\/strong>\r\n<strong>            'key' =&gt; $subscription_key,<\/strong>\r\n<strong>            'endpoint' =&gt; $endpoint<\/strong>\r\n<strong>        ]);<\/strong>\r\n<strong>        $subscription-&gt;key = $subscription_key;<\/strong>\r\n<strong>        $subscription-&gt;endpoint = $endpoint;<\/strong>\r\n<strong>        $subscription-&gt;public_key = $public_key;<\/strong>\r\n<strong>        $subscription-&gt;auth_token = $auth_token;<\/strong>\r\n<strong>        $subscription-&gt;content_encoding = 'aesgcm';<\/strong>\r\n<strong>        $result = $subscription-&gt;save();<\/strong>\r\n\r\n<strong>        return ['result' =&gt; $result];<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function destroy(Request $request)<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        \/\/ \u6ce8\u610f\uff1a \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306f\u7701\u7565\u3057\u3066\u307e\u3059<\/strong>\r\n\r\n<strong>        $result = false;<\/strong>\r\n<strong>        $endpoint = $request-&gt;input('subscription.endpoint');<\/strong>\r\n<strong>        $subscription = AnonymousPushSubscription::where('endpoint', $endpoint)-&gt;first();<\/strong>\r\n\r\n<strong>        if(! is_null($subscription)) {<\/strong>\r\n\r\n<strong>            $result = $subscription-&gt;delete();<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        return ['result' =&gt; $result];<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    public function test() \/\/ \u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u30c6\u30b9\u30c8\u7528<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $subscription_key = 'new_item_added'; \/\/ \u65b0\u5546\u54c1\u5165\u8377<\/strong>\r\n<strong>        $message = (new WebPushMessage())<\/strong>\r\n<strong>            -&gt;title('\u65b0\u5546\u54c1\u304c\u5165\u8377\u3057\u307e\u3057\u305f\uff01')<\/strong>\r\n<strong>            -&gt;body('\u5165\u8377\u3057\u305f\u65b0\u5546\u54c1\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002')<\/strong>\r\n<strong>            -&gt;data(['url' =&gt; 'https:\/\/example.com\/new_item']); \/\/ \u4eca\u56de\u306f\u901a\u77e5\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3082\u4f55\u3082\u8d77\u304d\u307e\u305b\u3093\u304c\u3001\u53c2\u8003\u3068\u3057\u3066\u8ffd\u52a0\u3057\u307e\u3059<\/strong>\r\n\r\n<strong>        Notification::route('to_anonymous_push', null)<\/strong>\r\n<strong>            -&gt;notify(new AnonymousPushNotification($subscription_key, $message));<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p><code>subscribe()<\/code>\u306f\u767b\u9332\u7528\u3067\u3001<code>unsubscribe()<\/code>\u306f\u89e3\u9664\u7528\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>test<\/code>\u306f\u3053\u306e\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u304c\u9001\u4fe1\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/div>\n<\/div>\n<h2>\u30d3\u30e5\u30fc\u3092\u3064\u304f\u308b<\/h2>\n<p>\u7d9a\u3044\u3066\u3001\u5b9f\u969b\u306b\u8868\u793a\u3055\u308c\u308b\u30d3\u30e5\u30fc\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u6700\u8fd1\u306f<code>React + Inertia.js<\/code>\u3092\u4f7f\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u300c<strong>\u3053\u306e\u958b\u767a\u6848\u4ef6\u304b\u3089\u3059\u308b\u3068\u3001\u30aa\u30fc\u30d0\u30fc\u30b9\u30da\u30c3\u30af\u306a\u306e\u306b\u3001\u308f\u3056\u308f\u3056\u96e3\u3057\u3044\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u9f3b\u30bf\u30ab\u30c0\u30ab\u306b\u306a\u3063\u3066\u308b\u3060\u3051\u3058\u3083\u306a\u3044\u2026\uff1f\uff1f<\/strong>\u300d\uff08\u3064\u307e\u308a\u3001\u672c\u8cea\u3092\u898b\u5931\u3063\u3066\u308b\u3093\u3058\u3083\u2026\ud83e\udd14\uff09\u3068\u601d\u3063\u305f\u308a\u3082\u3057\u3066\u3044\u305f\u306e\u3067\u4eca\u56de\u306f\u5b8c\u5168\u30cd\u30a4\u30c6\u30a3\u30d6\u306e<code>JavaScript<\/code>\uff08\u30d0\u30cb\u30e9JS\uff09\u3067\u3064\u304f\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u3064\u304f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>resources\/views\/anonymous_push\/index.blade.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;html&gt;<\/strong>\r\n<strong>&lt;head&gt;<\/strong>\r\n<strong>    &lt;script src=\"https:\/\/cdn.tailwindcss.com\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>    &lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/axios\/1.3.4\/axios.min.js\"&gt;&lt;\/script&gt;<\/strong>\r\n<strong>&lt;\/head&gt;<\/strong>\r\n<strong>&lt;body&gt;<\/strong>\r\n<strong>    &lt;div class=\"p-5\"&gt;<\/strong>\r\n<strong>        &lt;h1 class=\"mb-2\"&gt;\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\uff08\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u4e0d\u8981\uff09\u306e\u30c6\u30b9\u30c8&lt;\/h1&gt;<\/strong>\r\n\r\n<strong>        &lt;button id=\"subscription_button\" type=\"button\" class=\"bg-green-800 text-white p-2 rounded mr-2\"&gt;\u767b\u9332\u3059\u308b&lt;\/button&gt;<\/strong>\r\n<strong>        &lt;button id=\"unsubscription_button\" type=\"button\" class=\"bg-red-700 text-white p-2 rounded\"&gt;\u89e3\u9664\u3059\u308b&lt;\/button&gt;<\/strong>\r\n\r\n<strong>    &lt;\/div&gt;<\/strong>\r\n<strong>    &lt;script&gt;<\/strong>\r\n\r\n<strong>        \/\/ \u5909\u6570 \uff06 \u5b9a\u6570<\/strong>\r\n<strong>        const vapidPublicKey = '{{ env('VAPID_PUBLIC_KEY') }}';<\/strong>\r\n<strong>        const getUint8VapidPublicKey = () =&gt; {<\/strong>\r\n\r\n<strong>            let key = vapidPublicKey;<\/strong>\r\n<strong>            key += '='.repeat((4 - key.length % 4) % 4);<\/strong>\r\n<strong>            const base64 = key<\/strong>\r\n<strong>                .replace(new RegExp('\\-', 'g'), '+')<\/strong>\r\n<strong>                .replace(new RegExp('_', 'g'), '\/');<\/strong>\r\n\r\n<strong>            const binary = window.atob(base64);<\/strong>\r\n<strong>            const binaryLength = binary.length;<\/strong>\r\n<strong>            let uint8Array = new Uint8Array(binaryLength);<\/strong>\r\n\r\n<strong>            for(let i = 0; i &lt; binaryLength; i++) {<\/strong>\r\n\r\n<strong>                uint8Array[i] = binary.charCodeAt(i);<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>            return uint8Array.buffer;<\/strong>\r\n\r\n<strong>        };<\/strong>\r\n<strong>        const pushManager = () =&gt; {<\/strong>\r\n\r\n<strong>            return webPushRegistration.pushManager;<\/strong>\r\n\r\n<strong>        };<\/strong>\r\n<strong>        let webPushRegistration = null;<\/strong>\r\n<strong>        let isSubscribed = false;<\/strong>\r\n\r\n<strong>        \/\/ \u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5<\/strong>\r\n<strong>        const addSubscriptionEvents = () =&gt; {<\/strong>\r\n\r\n<strong>            document.getElementById('subscription_button')<\/strong>\r\n<strong>                .addEventListener('click', () =&gt; subscribe());<\/strong>\r\n<strong>            document.getElementById('unsubscription_button')<\/strong>\r\n<strong>                .addEventListener('click', () =&gt; unsubscribe());<\/strong>\r\n\r\n<strong>        };<\/strong>\r\n<strong>        const subscribe = () =&gt; {<\/strong>\r\n\r\n<strong>            const subscriptionOptions = {<\/strong>\r\n<strong>                userVisibleOnly: true,<\/strong>\r\n<strong>                applicationServerKey: getUint8VapidPublicKey(),<\/strong>\r\n<strong>            };<\/strong>\r\n\r\n<strong>            webPushRegistration<\/strong>\r\n<strong>                .pushManager<\/strong>\r\n<strong>                .subscribe(subscriptionOptions)<\/strong>\r\n<strong>                .then(subscription =&gt; {<\/strong>\r\n\r\n<strong>                    const url = '\/anonymous_push';<\/strong>\r\n<strong>                    const data = { subscription: subscription };<\/strong>\r\n\r\n<strong>                    axios.post(url, data)<\/strong>\r\n<strong>                        .then(response =&gt; {<\/strong>\r\n\r\n<strong>                            if(response.data.result === true) {<\/strong>\r\n\r\n<strong>                                isSubscribed = true;<\/strong>\r\n<strong>                                alert('\u767b\u9332\u3057\u307e\u3057\u305f\u3002');<\/strong>\r\n\r\n<strong>                            }<\/strong>\r\n\r\n<strong>                        });<\/strong>\r\n\r\n<strong>                });<\/strong>\r\n\r\n<strong>        };<\/strong>\r\n<strong>        const unsubscribe = () =&gt; {<\/strong>\r\n\r\n<strong>            webPushRegistration<\/strong>\r\n<strong>                .pushManager<\/strong>\r\n<strong>                .getSubscription()<\/strong>\r\n<strong>                .then(subscription =&gt; {<\/strong>\r\n\r\n<strong>                    subscription<\/strong>\r\n<strong>                        .unsubscribe()<\/strong>\r\n<strong>                        .then(() =&gt; {<\/strong>\r\n\r\n<strong>                            const url = '\/anonymous_push';<\/strong>\r\n<strong>                            const data = {<\/strong>\r\n<strong>                                _method: 'DELETE',<\/strong>\r\n<strong>                                subscription: subscription,<\/strong>\r\n<strong>                            };<\/strong>\r\n\r\n<strong>                            axios.post(url, data)<\/strong>\r\n<strong>                                .then(response =&gt; {<\/strong>\r\n\r\n<strong>                                    if(response.data.result === true) {<\/strong>\r\n\r\n<strong>                                        isSubscribed = false;<\/strong>\r\n<strong>                                        alert('\u89e3\u9664\u3057\u307e\u3057\u305f\u3002');<\/strong>\r\n\r\n<strong>                                    }<\/strong>\r\n\r\n<strong>                                });<\/strong>\r\n\r\n<strong>                        });<\/strong>\r\n\r\n<strong>                });<\/strong>\r\n\r\n<strong>        };<\/strong>\r\n\r\n<strong>        \/\/ \u6e96\u5099<\/strong>\r\n<strong>        window.addEventListener('load', () =&gt; {<\/strong>\r\n\r\n<strong>            if('serviceWorker' in navigator &amp;&amp; 'PushManager' in window) {<\/strong>\r\n\r\n<strong>                addSubscriptionEvents();<\/strong>\r\n\r\n<strong>                const serviceWorkerPath = '\/anonymous_push_sw.js';<\/strong>\r\n\r\n<strong>                navigator<\/strong>\r\n<strong>                    .serviceWorker<\/strong>\r\n<strong>                    .register(serviceWorkerPath)<\/strong>\r\n<strong>                    .then(registration =&gt; {<\/strong>\r\n\r\n<strong>                        webPushRegistration = registration;<\/strong>\r\n<strong>                        webPushRegistration.pushManager.getSubscription()<\/strong>\r\n<strong>                            .then(subscription =&gt; {<\/strong>\r\n\r\n<strong>                                isSubscribed = ! (subscription === null); \/\/ \u3059\u3067\u306b\u767b\u9332\u6e08\u307f\u304b\u3069\u3046\u304b<\/strong>\r\n\r\n<strong>                            });<\/strong>\r\n\r\n<strong>                    });<\/strong>\r\n\r\n<strong>            } else {<\/strong>\r\n\r\n<strong>                alert('\u3053\u306e\u30d6\u30e9\u30a6\u30b6\u3067\u306f\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u3067\u304d\u307e\u305b\u3093\u3002');<\/strong>\r\n\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<div>\n<p>\u30d0\u30cb\u30e9JS\uff08\u4f55\u3082\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u308f\u305a\u306b\u7d20\u306e<code>JavaScript<\/code>\u3092\u4f7f\u3046\u958b\u767a\u65b9\u6cd5\uff09\u3067\u66f8\u3044\u3066\u3044\u308b\u306e\u3067\u5c11\u3057\u5197\u9577\u306a\u90e8\u5206\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u6a5f\u80fd\u306e\u5834\u5408\u306f\u3053\u3063\u3061\u3067\u3082\u5341\u5206\u3067\u3059\u306d\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001<code>CDN<\/code>\u306f\u4e45\u3057\u3076\u308a\u306b\u4f7f\u3044\u307e\u3057\u305f\u304c\u3001\u3084\u306f\u308a\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u306d\uff01\u3068\u306f\u3044\u3048\u3001\u304a\u4ed5\u4e8b\u306e\u5834\u5408\u306f\u30d0\u30cb\u30e9\u3067\u66f8\u304f\u3068\u3057\u3066\u3082\u5fc5\u305a\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3084\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u81ea\u524d\u3067\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u3057\u307e\u3059\u3051\u3069\u306d\u2026\ud83d\ude04<\/p>\n<\/div>\n<h1>ServiceWorker \u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5148\u307b\u3069\u306e<code>JavaScript<\/code>\u5185\u3067\u547c\u3073\u51fa\u3057\u3066\u3044\u305f<code>ServiceWorker<\/code>\u300c<strong>anonymous_sw.js<\/strong>\u300d\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p><strong>public\/anonymous_push_sw.js<\/strong><\/p>\n<div>\n<pre><strong>self.addEventListener('push', e =&gt; {<\/strong>\r\n\r\n<strong>    const json = e.data.json();<\/strong>\r\n<strong>    const title = json.title;<\/strong>\r\n<strong>    const options = {<\/strong>\r\n<strong>        body: json.body,<\/strong>\r\n<strong>        data: {<\/strong>\r\n<strong>            url: json.data.url,<\/strong>\r\n<strong>        }<\/strong>\r\n<strong>    };<\/strong>\r\n<strong>    e.waitUntil(<\/strong>\r\n<strong>        self.registration.showNotification(title, options)<\/strong>\r\n<strong>    );<\/strong>\r\n\r\n<strong>});<\/strong>\r\n\r\n\/\/ \u901a\u77e5\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u305f\u3068\u304d\u306e\u51e6\u7406\u306f\u3053\u3053\u306b\u66f8\u304f\uff08\u4eca\u56de\u306f\u7701\u7565\uff09<\/pre>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u6700\u5f8c\u306b\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<\/div>\n<div>\n<pre>\/\/ \u7701\u7565\r\n\r\n<strong>use App\\Http\\Controllers\\AnonymousPushController;<\/strong>\r\n\r\n\/\/ \u7701\u7565\r\n\r\n<strong>Route::prefix('anonymous_push')-&gt;controller(AnonymousPushController::class)-&gt;group(function () {<\/strong>\r\n<strong>    Route::get('\/', 'index');<\/strong>\r\n<strong>    Route::get('\/test', 'test');<\/strong>\r\n<strong>    Route::post('\/', 'store');<\/strong>\r\n<strong>    Route::delete('\/', 'destroy');<\/strong>\r\n<strong>});<\/strong><\/pre>\n<\/div>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2024.4.18\u3011<br \/>\n<\/strong>\u30eb\u30fc\u30c8\u3092\u7701\u7565\u3057\u3066\u307e\u3057\u305f\u304c\u8ffd\u8a18\u3057\u307e\u3057\u305f\u3002<br \/>\n\u6df7\u4e71\u3055\u305b\u3066\u3057\u307e\u3063\u3066\u3059\u307f\u307e\u305b\u3093\uff01<\/p>\n<p>\u3053\u308c\u3067\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\u2757<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude04\u2728<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b\uff08\u30c7\u30e2\u30da\u30fc\u30b8\u3092\u7528\u610f\u3057\u307e\u3057\u305f\uff09<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2026\u3068\u3044\u3044\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u304c\u3001\u305b\u3063\u304b\u304f\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306a\u3057\u3067OK\u306a\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u306a\u306e\u3067\u3001\u30c7\u30e2\u30da\u30fc\u30b8\u3092\u7528\u610f\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305c\u3072\u3054\u81ea\u8eab\u3067\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u2757<\/p>\n<p><strong>\ud83d\udcdd \u30c7\u30e2\u30da\u30fc\u30b8\uff1a<\/strong> <a href=\"https:\/\/demo-laravel10x-react.capilano-fw.com\/anonymous_push\" target=\"_blank\" rel=\"noopener\">\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\uff08\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u4e0d\u8981\uff09\u306e\u30c6\u30b9\u30c8<\/a><\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u56de\u306e\u3088\u3046\u306b\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u3057\u306a\u304f\u3066\u3082\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u6a5f\u80fd\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u901a\u77e5\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u307e\u3060\u767a\u58f2\u3057\u3066\u3044\u306a\u3044\u5546\u54c1\u304c\u5165\u8377\u3057\u305f\u3068\u304d\uff08\u65e9\u3044\u3082\u306e\u52dd\u3061\u306e\u30d1\u30bf\u30fc\u30f3\u306e\u6642\uff09<\/li>\n<li>\u4eba\u6c17\u306e\u98f2\u98df\u5e97\u306b\u884c\u5217\u304c\u3067\u304d\u3066\u3044\u308b\u5834\u5408\u306b\u9806\u756a\u304c\u6765\u305f\u3089\u901a\u77e5\u3092\u3059\u308b\u30b5\u30fc\u30d3\u30b9<\/li>\n<li>\u30ad\u30e3\u30f3\u30bb\u30eb\u5f85\u3061\u306e\u90e8\u5c4b\u306b\u767b\u9332\u3057\u3066\u304a\u3051\u3070\u3001\u5f8c\u3067 <code>Yes<\/code> or <code>No<\/code> \u3092\u901a\u77e5\u3057\u3066\u304f\u308c\u308b<\/li>\n<\/ul>\n<p>\u306a\u3069\u306a\u3069\u3002<\/p>\n<p>\u3082\u3057\u3053\u3046\u3044\u3063\u305f\u30b5\u30fc\u30d3\u30b9\u3092\u958b\u767a\u3055\u308c\u305f\u3044\u65b9\u306f\u305c\u3072\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u9023\u7d61\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 + \u30d0\u30cb\u30e9JS<\/strong>\u300d\u3067\u300c<strong>\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u304c\u4e0d\u8981\u306e\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u6a5f\u80fd<\/strong>\u300d\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u5c11\u3057\u624b\u9593\u3067\u3059\u304c\u3001<code>iOS 16.4<\/code>\u304b\u3089\u306f<code>iPhone<\/code>\u3067\u3082\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u306e\u3067\u3001\u5229\u7528\u7bc4\u56f2\u304c\u62e1\u5927\u3059\u308b\u306e\u306f\u9593\u9055\u3044\u306a\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u3044\u308d\u3093\u306a\u6d3b\u7528\u65b9\u6cd5\u3092\u8003\u3048\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-6071 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_8-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/>\u300c\u3042\u3063\u305f\u304b\u304f\u306a\u3063\u305f\u304b\u3089\u3001<br \/>\n\u307e\u305f\u8857\u89d2\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b<br \/>\n\u51fa\u304b\u3051\u3088\u3046\u304b\u306a\uff08\u30ef\u30af\u30ef\u30af\u266a\uff09\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u5148\u65e5\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u306b\u95a2\u3059\u308b\u300cLaravel + React\u3067\u5b9f\u73fe\u3059\u308bWeb\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\uff01ChatGPT\u3068\u5171\u306biOS 16.4\u3067\u8a66\u3057\u3066\u307f\u305f\u7d50\u679c\u300d\u3068\u3044\u3046\u8a18 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=11555\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel\u30e6\u30fc\u30b6\u30fc\u5fc5\u898b\uff01\u30e6\u30fc\u30b6\u30fc\u767b\u9332\u306a\u3057\u3067\u30a6\u30a7\u30d6\u30d7\u30c3\u30b7\u30e5\u901a\u77e5\u3092\u5b9f\u88c5\u3057\u3088\u3046\uff01&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":11566,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[252],"class_list":["post-11555","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-252"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11555","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=11555"}],"version-history":[{"count":15,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11555\/revisions"}],"predecessor-version":[{"id":12663,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11555\/revisions\/12663"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/11566"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}