diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php new file mode 100644 index 0000000..8fdbed9 --- /dev/null +++ b/app/Http/Controllers/NotificationController.php @@ -0,0 +1,16 @@ +user()->notify(new LineTest('Notification from LINE Messaging API')); + + return back(); + } +} diff --git a/app/Models/User.php b/app/Models/User.php index f0b9177..f08c831 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -52,4 +52,9 @@ public function routeNotificationForLineNotify($notification) { return $this->notify_token; } + + public function routeNotificationForLine($notification) + { + return $this->line_id; + } } diff --git a/app/Notifications/LineTest.php b/app/Notifications/LineTest.php new file mode 100644 index 0000000..443d72e --- /dev/null +++ b/app/Notifications/LineTest.php @@ -0,0 +1,42 @@ +text($this->message) + ->sticker(446, random_int(1988, 2027)); + } +} diff --git a/composer.json b/composer.json index 18e4aac..acfcc2b 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "laravel/framework": "^11.0", "laravel/socialite": "^5.6", "laravel/tinker": "^2.0", - "revolution/laravel-line-sdk": "^3.0" + "revolution/laravel-line-sdk": "^3.3" }, "require-dev": { "barryvdh/laravel-ide-helper": "^3.0", diff --git a/composer.lock b/composer.lock index e56edaf..78378ab 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "47fc8ad86a89e7cc79364ae5883bfe8e", + "content-hash": "4b5ef1371727264bbdac7e09fdef4e2e", "packages": [ { "name": "brick/math", @@ -2338,24 +2338,24 @@ }, { "name": "nette/schema", - "version": "v1.3.0", + "version": "v1.3.2", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188" + "reference": "da801d52f0354f70a638673c4a0f04e16529431d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", + "url": "https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d", + "reference": "da801d52f0354f70a638673c4a0f04e16529431d", "shasum": "" }, "require": { "nette/utils": "^4.0", - "php": "8.1 - 8.3" + "php": "8.1 - 8.4" }, "require-dev": { - "nette/tester": "^2.4", + "nette/tester": "^2.5.2", "phpstan/phpstan-nette": "^1.0", "tracy/tracy": "^2.8" }, @@ -2394,9 +2394,9 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.0" + "source": "https://github.com/nette/schema/tree/v1.3.2" }, - "time": "2023-12-11T11:54:22+00:00" + "time": "2024-10-06T23:10:23+00:00" }, { "name": "nette/utils", @@ -3650,16 +3650,16 @@ }, { "name": "revolution/laravel-line-sdk", - "version": "3.2.5", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/kawax/laravel-line-sdk.git", - "reference": "44072c72f9a4833753b9dd9026d26a38e5d9c7f1" + "reference": "271b2af70800bb257611ddb2e68d557889eee428" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kawax/laravel-line-sdk/zipball/44072c72f9a4833753b9dd9026d26a38e5d9c7f1", - "reference": "44072c72f9a4833753b9dd9026d26a38e5d9c7f1", + "url": "https://api.github.com/repos/kawax/laravel-line-sdk/zipball/271b2af70800bb257611ddb2e68d557889eee428", + "reference": "271b2af70800bb257611ddb2e68d557889eee428", "shasum": "" }, "require": { @@ -3707,9 +3707,9 @@ ], "support": { "issues": "https://github.com/kawax/laravel-line-sdk/issues", - "source": "https://github.com/kawax/laravel-line-sdk/tree/3.2.5" + "source": "https://github.com/kawax/laravel-line-sdk/tree/3.3.2" }, - "time": "2024-10-02T08:22:53+00:00" + "time": "2024-10-07T08:26:55+00:00" }, { "name": "symfony/clock", @@ -6356,16 +6356,16 @@ }, { "name": "composer/class-map-generator", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/composer/class-map-generator.git", - "reference": "b1b3fd0b4eaf3ddf3ee230bc340bf3fff454a1a3" + "reference": "98bbf6780e56e0fd2404fe4b82eb665a0f93b783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/class-map-generator/zipball/b1b3fd0b4eaf3ddf3ee230bc340bf3fff454a1a3", - "reference": "b1b3fd0b4eaf3ddf3ee230bc340bf3fff454a1a3", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/98bbf6780e56e0fd2404fe4b82eb665a0f93b783", + "reference": "98bbf6780e56e0fd2404fe4b82eb665a0f93b783", "shasum": "" }, "require": { @@ -6378,8 +6378,8 @@ "phpstan/phpstan-deprecation-rules": "^1", "phpstan/phpstan-phpunit": "^1", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/filesystem": "^5.4 || ^6", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8", + "symfony/filesystem": "^5.4 || ^6" }, "type": "library", "extra": { @@ -6409,7 +6409,7 @@ ], "support": { "issues": "https://github.com/composer/class-map-generator/issues", - "source": "https://github.com/composer/class-map-generator/tree/1.3.4" + "source": "https://github.com/composer/class-map-generator/tree/1.4.0" }, "funding": [ { @@ -6425,7 +6425,7 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:13:04+00:00" + "time": "2024-10-03T18:14:00+00:00" }, { "name": "composer/pcre", @@ -7639,16 +7639,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.3.6", + "version": "11.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d62c45a19c665bb872c2a47023a0baf41a98bb2b" + "reference": "89fe0c530133c08f7fff89d3d727154e4e504925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d62c45a19c665bb872c2a47023a0baf41a98bb2b", - "reference": "d62c45a19c665bb872c2a47023a0baf41a98bb2b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/89fe0c530133c08f7fff89d3d727154e4e504925", + "reference": "89fe0c530133c08f7fff89d3d727154e4e504925", "shasum": "" }, "require": { @@ -7687,7 +7687,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.3-dev" + "dev-main": "11.4-dev" } }, "autoload": { @@ -7719,7 +7719,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.6" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.0" }, "funding": [ { @@ -7735,7 +7735,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T10:54:28+00:00" + "time": "2024-10-05T08:39:03+00:00" }, { "name": "sebastian/cli-parser", @@ -9093,13 +9093,13 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.2" }, - "platform-dev": {}, + "platform-dev": [], "platform-overrides": { "ext-sockets": "1.0.0" }, diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index cf8327b..7defed1 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -35,6 +35,14 @@ + +
diff --git a/routes/web.php b/routes/web.php index 40727a9..89323b9 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,7 @@ name('push'); + Route::get('notification', NotificationController::class) + ->name('notification'); + Route::get('info', function () { dump(Bot::getBotInfo()); dump(Bot::verifyWebhook());