Prepared Pusher push notifications

This commit is contained in:
Miguel Nogueira 2022-02-07 22:54:10 +00:00
parent 1c9f223d3f
commit 6a4ba00c78
7 changed files with 318 additions and 2 deletions

View File

@ -76,6 +76,10 @@ PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
BEAMS_INSTANCE_ID=
BEAMS_SECRET_KEY=
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

View File

@ -95,7 +95,7 @@ class ApplicationService
foreach (User::all() as $user) {
if ($user->hasRole('admin')) {
$user->notify((new NewApplicant($application, $vacancy->first()))->delay(now()->addSeconds(10)));
$user->notify((new NewApplicant($application, $vacancy->first())));
}
}

View File

@ -19,6 +19,8 @@
"graham-campbell/markdown": "^13.1",
"guzzlehttp/guzzle": "^7.0.1",
"jeroennoten/laravel-adminlte": "^3.2",
"laravel-notification-channels/discord": "^1.3",
"laravel-notification-channels/pusher-push-notifications": "^3.0",
"laravel/framework": "^8.0",
"laravel/slack-notification-channel": "^2.0",
"laravel/socialite": "^5.2",

295
composer.lock generated
View File

@ -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": "0953ec554f3c7f44531e640bfcbd73c6",
"content-hash": "a598474c790e88ec146e0613073b7725",
"packages": [
{
"name": "almasaeed2010/adminlte",
@ -1387,6 +1387,63 @@
},
"time": "2020-10-22T13:48:01+00:00"
},
{
"name": "firebase/php-jwt",
"version": "v5.5.1",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "83b609028194aa042ea33b5af2d41a7427de80e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/83b609028194aa042ea33b5af2d41a7427de80e6",
"reference": "83b609028194aa042ea33b5af2d41a7427de80e6",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": ">=4.8 <=9"
},
"suggest": {
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
},
"type": "library",
"autoload": {
"psr-4": {
"Firebase\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Neuman Vong",
"email": "neuman+pear@twilio.com",
"role": "Developer"
},
{
"name": "Anant Narayanan",
"email": "anant@php.net",
"role": "Developer"
}
],
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
"homepage": "https://github.com/firebase/php-jwt",
"keywords": [
"jwt",
"php"
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v5.5.1"
},
"time": "2021-11-08T20:18:51+00:00"
},
{
"name": "fruitcake/laravel-cors",
"version": "v1.0.6",
@ -2166,6 +2223,153 @@
},
"time": "2021-11-17T06:57:49+00:00"
},
{
"name": "laravel-notification-channels/discord",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/laravel-notification-channels/discord.git",
"reference": "7e88654a40aac1ce164194153b336c3f21c23636"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel-notification-channels/discord/zipball/7e88654a40aac1ce164194153b336c3f21c23636",
"reference": "7e88654a40aac1ce164194153b336c3f21c23636",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/guzzle": "^6.3 || ^7.0",
"illuminate/console": "^6.0 || ^7.0 || ^8.0",
"illuminate/notifications": "^6.0 || ^7.0 || ^8.0",
"illuminate/queue": "^6.0 || ^7.0 || ^8.0",
"illuminate/support": "^6.0 || ^7.0 || ^8.0",
"php": "^7.2|^8.0",
"textalk/websocket": "^1.2"
},
"require-dev": {
"mockery/mockery": "^1.3.3",
"orchestra/testbench": "^5.0 || ^6.0",
"phpunit/phpunit": "^8.5 || ^9.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"NotificationChannels\\Discord\\DiscordServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"NotificationChannels\\Discord\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Cody Scott",
"email": "cs475x@icloud.com",
"role": "Developer"
}
],
"description": "Laravel notification driver for Discord.",
"homepage": "https://github.com/laravel-notification-channels/discord",
"keywords": [
"channel",
"discord",
"driver",
"laravel",
"notification"
],
"support": {
"issues": "https://github.com/laravel-notification-channels/discord/issues",
"source": "https://github.com/laravel-notification-channels/discord/tree/1.3.0"
},
"time": "2020-12-26T22:05:21+00:00"
},
{
"name": "laravel-notification-channels/pusher-push-notifications",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/laravel-notification-channels/pusher-push-notifications.git",
"reference": "a3bfe644808768ba89745c8d8f74d280bddd0688"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel-notification-channels/pusher-push-notifications/zipball/a3bfe644808768ba89745c8d8f74d280bddd0688",
"reference": "a3bfe644808768ba89745c8d8f74d280bddd0688",
"shasum": ""
},
"require": {
"illuminate/events": "~7.0 || ~8.0 || ~9.0",
"illuminate/notifications": "~7.0 || ~8.0 || ~9.0",
"illuminate/queue": "~7.0 || ~8.0 || ~9.0",
"illuminate/support": "~7.0 || ~8.0 || ~9.0",
"php": ">=7.4",
"pusher/pusher-push-notifications": "^1.1"
},
"require-dev": {
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^9.5"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"NotificationChannels\\PusherPushNotifications\\PusherPushNotificationsServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"NotificationChannels\\PusherPushNotifications\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mohamed Said",
"email": "themsaid@gmail.com",
"homepage": "https://themsaid.com"
},
{
"name": "Marcel Pociot",
"email": "hello@marcelpociot.com",
"homepage": "http://marcelpociot.com"
},
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be"
},
{
"name": "Sebastian De Deyne",
"email": "sebastian@spatie.be",
"homepage": "https://sebastiandedeyne.com"
}
],
"description": "Pusher native Push Notifications driver.",
"homepage": "https://github.com/LaravelNotificationChannels/pusher-push-notifications",
"keywords": [
"laravel",
"notifications",
"pusher",
"pusher-push-notifications"
],
"support": {
"issues": "https://github.com/laravel-notification-channels/pusher-push-notifications/issues",
"source": "https://github.com/laravel-notification-channels/pusher-push-notifications/tree/3.0.0"
},
"time": "2022-02-07T00:09:50+00:00"
},
{
"name": "laravel/framework",
"version": "v8.82.0",
@ -4935,6 +5139,46 @@
},
"time": "2022-01-03T13:58:38+00:00"
},
{
"name": "pusher/pusher-push-notifications",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/pusher/push-notifications-php.git",
"reference": "c8926f956ba4f7e681b4261220efd77f008a131d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pusher/push-notifications-php/zipball/c8926f956ba4f7e681b4261220efd77f008a131d",
"reference": "c8926f956ba4f7e681b4261220efd77f008a131d",
"shasum": ""
},
"require": {
"firebase/php-jwt": "^5.0",
"guzzlehttp/guzzle": "~6.0 || ~7.0",
"php": ">=5.6.0"
},
"require-dev": {
"doctrine/instantiator": "1.0.5",
"phpunit/phpunit": "~5.7.0",
"symfony/yaml": "~3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Pusher\\PushNotifications\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"support": {
"issues": "https://github.com/pusher/push-notifications-php/issues",
"source": "https://github.com/pusher/push-notifications-php/tree/1.1.2"
},
"time": "2020-10-23T09:37:07+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
@ -8269,6 +8513,55 @@
],
"time": "2022-01-17T16:30:37+00:00"
},
{
"name": "textalk/websocket",
"version": "1.5.5",
"source": {
"type": "git",
"url": "https://github.com/Textalk/websocket-php.git",
"reference": "846542f82658132cd36acb7a7e8ce0f03960c295"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Textalk/websocket-php/zipball/846542f82658132cd36acb7a7e8ce0f03960c295",
"reference": "846542f82658132cd36acb7a7e8ce0f03960c295",
"shasum": ""
},
"require": {
"php": "^7.2 | ^8.0",
"psr/log": "^1 | ^2 | ^3"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.0",
"phpunit/phpunit": "^8.0|^9.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"autoload": {
"psr-4": {
"WebSocket\\": "lib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Fredrik Liljegren"
},
{
"name": "Sören Jensen",
"email": "soren@abicart.se"
}
],
"description": "WebSocket client and server",
"support": {
"issues": "https://github.com/Textalk/websocket-php/issues",
"source": "https://github.com/Textalk/websocket-php/tree/1.5.5"
},
"time": "2021-08-07T10:21:40+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
"version": "2.2.4",

View File

@ -649,6 +649,17 @@ return [
'location' => 'https://cdn.jsdelivr.net/npm/flatpickr'
]
]
],
[
'name' => 'Pusher',
'active' => true,
'files' => [
[
'type' => 'js',
'asset' => false,
'location' => 'https://js.pusher.com/beams/1.0/push-notifications-cdn.js'
]
]
]
],
];

View File

@ -59,4 +59,9 @@ return [
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'pusher' => [
'beams_instance_id' => env(''),
'beams_secret_key' => 'Your Secret Key',
],
];

1
public/service-worker.js vendored Normal file
View File

@ -0,0 +1 @@
importScripts("https://js.pusher.com/beams/service-worker.js");